home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1997 May / PC Plus Super CD Issue 127 (May 1997).iso / delphi2 / delphite.exe / data.z / PENWIN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-04  |  100.9 KB  |  2,183 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1994,96 Borland International     }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit PenWin;
  12.  
  13. { Pen Windows functions, types, and definitions  }
  14.  
  15. { "FBC" in the comments means that the feature exists only for
  16.   backward compatibility. It should not be used by new applications. }
  17.   
  18. interface
  19.  
  20. uses Windows, Messages, MMSystem;
  21.  
  22. { Enabled Alphabet: }
  23.  
  24. const
  25.   ALC_DEFAULT              = $00000000;  { nothing }
  26.   ALC_LCALPHA              = $00000001;  { a..z }
  27.   ALC_UCALPHA              = $00000002;  { A..Z }
  28.   ALC_NUMERIC              = $00000004;  { 0..9 }
  29.   ALC_PUNC                 = $00000008;  { !-;`"?()&.,; and backslash }
  30.   ALC_MATH                 = $00000010;  // %^*()-+={}<>,/.
  31.   ALC_MONETARY             = $00000020;  { ,.$ or local }
  32.   ALC_OTHER                = $00000040;  { @#|_~[] }
  33.   ALC_ASCII                = $00000080;  { restrict to 7-bit chars 20..7f }
  34.   ALC_WHITE                = $00000100;  { white space }
  35.   ALC_NONPRINT             = $00000200;  { sp tab ret ctrl glyphs }
  36.   ALC_DBCS                 = $00000400;  { allow DBCS variety of SBCS }
  37.   ALC_JIS1                 = $00000800;  { kanji JPN, ShiftJIS 1 only }
  38.   ALC_GESTURE              = $00004000;  { gestures }
  39.   ALC_USEBITMAP            = $00008000;  { use rc.rgbfAlc to enable chars }
  40.   ALC_HIRAGANA             = $00010000;  { hiragana JPN }
  41.   ALC_KATAKANA             = $00020000;  { katakana JPN }
  42.   ALC_KANJI                = $00040000;  { kanji JPN, ShiftJIS 1+2+3 }
  43.   ALC_GLOBALPRIORITY       = $10000000; 
  44.   ALC_OEM                  = $0FF80000;  { OEM recognizer-specific }
  45.   ALC_RESERVED             = $E0003000;  { avail for future use }
  46.   ALC_NOPRIORITY           = $00000000;  { for alcPriority = none }
  47.  
  48.   ALC_ALPHA                = ALC_LCALPHA or ALC_UCALPHA;
  49.   ALC_ALPHANUMERIC         = ALC_ALPHA or ALC_NUMERIC;
  50.   ALC_SYSMINIMUM = ALC_ALPHANUMERIC or ALC_PUNC or ALC_WHITE or ALC_GESTURE;
  51.   ALC_ALL = ALC_SYSMINIMUM or ALC_MATH or ALC_MONETARY or ALC_OTHER or ALC_NONPRINT;
  52.   ALC_KANJISYSMINIMUM = ALC_SYSMINIMUM or ALC_HIRAGANA or ALC_KATAKANA or ALC_JIS1;
  53.   ALC_KANJIALL = ALC_ALL or ALC_HIRAGANA or ALC_KATAKANA or ALC_KANJI;
  54.  
  55. { box edit styles: }
  56.  
  57.   BXS_NONE                 = $0000;  { none }
  58.   BXS_RECT                 = $0001;  { use rectangle instead of cusp }
  59.   BXS_BOXCROSS             = $0004;  { use cross at box center }
  60.   BXS_MASK                 = $0007;  { mask for above }
  61.  
  62. { Public Bitmaps : }
  63.  
  64.   OBM_SKBBTNUP                = 32767; 
  65.   OBM_SKBBTNDOWN              = 32766; 
  66.   OBM_SKBBTNDISABLED          = 32765; 
  67.  
  68.   OBM_ZENBTNUP                = 32764; 
  69.   OBM_ZENBTNDOWN              = 32763; 
  70.   OBM_ZENBTNDISABLED          = 32762; 
  71.  
  72.   OBM_HANBTNUP                = 32761; 
  73.   OBM_HANBTNDOWN              = 32760; 
  74.   OBM_HANBTNDISABLED          = 32759; 
  75.  
  76.   OBM_KKCBTNUP                = 32758; 
  77.   OBM_KKCBTNDOWN              = 32757; 
  78.   OBM_KKCBTNDISABLED          = 32756; 
  79.  
  80.   OBM_SIPBTNUP                = 32755; 
  81.   OBM_SIPBTNDOWN              = 32754; 
  82.   OBM_SIPBTNDISABLED          = 32753; 
  83.  
  84.   OBM_PTYBTNUP                = 32752; 
  85.   OBM_PTYBTNDOWN              = 32751; 
  86.   OBM_PTYBTNDISABLED          = 32750; 
  87.  
  88. { Default pen cursor to indicate writing, points northwest }
  89.   IDC_PEN             = MAKEINTRESOURCE(32631); 
  90.  
  91. { alternate select cursor: upsidedown standard arrow, points southeast }
  92.   IDC_ALTSELECT       = MAKEINTRESOURCE(32501); 
  93.  
  94. { special SYV values: }
  95.   SYV_NULL                    = $00000000; 
  96.   SYV_UNKNOWN                 = $00000001; 
  97.   SYV_EMPTY                   = $00000003; 
  98.   SYV_BEGINOR                 = $00000010; 
  99.   SYV_ENDOR                   = $00000011; 
  100.   SYV_OR                      = $00000012; 
  101.   SYV_SOFTNEWLINE             = $00000020; 
  102.   SYV_SPACENULL               = $00010000;    { SyvCharacterToSymbol('\0') }
  103.  
  104. { SYV values for gestures: }
  105.   SYV_SELECTFIRST             = $0002FFC0;    { . means circle in following }
  106.   SYV_LASSO                   = $0002FFC1;    { lasso o-tap }
  107.   SYV_SELECTLEFT              = $0002FFC2;    { no glyph }
  108.   SYV_SELECTRIGHT             = $0002FFC3;    { no glyph }
  109.   SYV_SELECTLAST              = $0002FFCF;    { 16 SYVs reserved for selection }
  110.  
  111.   SYV_CLEARCHAR               = $0002FFD2;    { d. }
  112.   SYV_HELP                    = $0002FFD3;    { no glyph }
  113.   SYV_KKCONVERT               = $0002FFD4;    { k. }
  114.   SYV_CLEAR                   = $0002FFD5;    { d. }
  115.   SYV_INSERT                  = $0002FFD6;    { ^. }
  116.   SYV_CONTEXT                 = $0002FFD7;    { m. }
  117.   SYV_EXTENDSELECT            = $0002FFD8;    { no glyph }
  118.   SYV_UNDO                    = $0002FFD9;    { u. }
  119.   SYV_COPY                    = $0002FFDA;    { c. }
  120.   SYV_CUT                     = $0002FFDB;    { x. }
  121.   SYV_PASTE                   = $0002FFDC;    { p. }
  122.   SYV_CLEARWORD               = $0002FFDD;    { no glyph }
  123.   SYV_USER                    = $0002FFDE;    { reserved }
  124.   SYV_CORRECT                 = $0002FFDF;    { check. }
  125.  
  126.   SYV_BACKSPACE               = $00020008;    { no glyph }
  127.   SYV_TAB                     = $00020009;    { t. }
  128.   SYV_RETURN                  = $0002000D;    { n. }
  129.   SYV_SPACE                   = $00020020;    { s. }
  130.  
  131. { Application specific gestures, Circle a-z and Circle A-Z: }
  132.   SYV_APPGESTUREMASK          = $00020000; 
  133.   SYV_CIRCLEUPA               = $000224B6;    { map into Unicode space }
  134.   SYV_CIRCLEUPZ               = $000224CF;    {  for circled letters }
  135.   SYV_CIRCLELOA               = $000224D0; 
  136.   SYV_CIRCLELOZ               = $000224E9; 
  137.  
  138. { SYV definitions for shapes: }
  139.   SYV_SHAPELINE               = $00040001; 
  140.   SYV_SHAPEELLIPSE            = $00040002; 
  141.   SYV_SHAPERECT               = $00040003; 
  142.   SYV_SHAPEMIN                = SYV_SHAPELINE; { alias }
  143.   SYV_SHAPEMAX                = SYV_SHAPERECT; { alias }
  144.  
  145. { SYV classes: }
  146.   SYVHI_SPECIAL               = 0; 
  147.   SYVHI_ANSI                  = 1; 
  148.   SYVHI_GESTURE               = 2; 
  149.   SYVHI_KANJI                 = 3; 
  150.   SYVHI_SHAPE                 = 4; 
  151.   SYVHI_UNICODE               = 5; 
  152.   SYVHI_VKEY                  = 6; 
  153.  
  154.   
  155. { IEdit Pop-up Menu Command Items }
  156.  
  157.   IEM_UNDO                    = 1;         { Undo }
  158.   IEM_CUT                     = 2;         { Cut }
  159.   IEM_COPY                    = 3;         { Copy }
  160.   IEM_PASTE                   = 4;         { Paste }
  161.   IEM_CLEAR                   = 5;         { Clear }
  162.   IEM_SELECTALL               = 6;         { Select All Strokes }
  163.   IEM_ERASE                   = 7;         { Use Eraser }
  164.   IEM_PROPERTIES              = 8;         { DoProperties }
  165.   IEM_LASSO                   = 9;         { Use Lasso }
  166.   IEM_RESIZE                  = 10;        { Resize }
  167.  
  168.   IEM_USER                        = 100;   { first menu item# available to app }
  169.  
  170. { IEdit Style Attributes }
  171.   IES_BORDER                  = $0001;   { ctl has a border }
  172.   IES_HSCROLL                 = $0002;   { ctl is horizontally scrollable }
  173.   IES_VSCROLL                 = $0004;   { ctl is vertically scrollable }
  174.   IES_OWNERDRAW               = $0008;   { ctl will be drawn by parent window }
  175.  
  176.  
  177. { PenData API constants: }
  178.  
  179. { ANIMATEINFO callback options: }
  180.   AI_CBSTROKE                 = $FFFF;  { Animate callback after every stroke }
  181.  
  182. { ANIMATEINFO options: }
  183.   AI_SKIPUPSTROKES            = $0001;  { ignore upstrokes in animation }
  184.  
  185. { CompressPenData() API options: }
  186.   CMPD_COMPRESS               = $0001; 
  187.   CMPD_DECOMPRESS             = $0002; 
  188.  
  189. { CreatePenDataRegion types: }
  190.   CPDR_BOX                    = 1;      { bounding box }
  191.   CPDR_LASSO                  = 2;      { lasso }
  192.  
  193. { CreatePenData (CPD) and Pen Hardware (PHW) Flags; }
  194. { The order of PHW flags is important: }
  195.   CPD_DEFAULT                 = $047F;  { CPD_TIME | PHW_ALL }
  196.   CPD_USERBYTE                = $0100;  { alloc 8 bits/stroke }
  197.   CPD_USERWORD                = $0200;  { alloc 16 bits/stroke }
  198.   CPD_USERDWORD               = $0300;  { alloc 32 bits/stroke }
  199.   CPD_TIME                    = $0400;  { maintain abs time info per stroke }
  200.  
  201. { DrawPenDataEx() flags/options: }
  202.   DPD_HDCPEN                  = $0001;  { use pen selected in HDC }
  203.   DPD_DRAWSEL                 = $0002;  { draw the selection }
  204.  
  205. { ExtractPenDataPoints options (EPDP_xx): }
  206.   EPDP_REMOVE                 = $0001;  { Remove points from the pendata }
  207.  
  208. { ExtractPenDataStrokes options and modifiers (EPDS_xx): }
  209.   EPDS_SELECT                 = 1;      { selected strokes }
  210.   EPDS_STROKEINDEX            = 2;      { index }
  211.   EPDS_USER                   = 3;      { user-specific value }
  212.   EPDS_PENTIP                 = 4;      { complete pentip }
  213.   EPDS_TIPCOLOR               = 5;      { pentip color }
  214.   EPDS_TIPWIDTH               = 6;      { pentip width }
  215.   EPDS_TIPNIB                 = 7;      { pentip nib style }
  216.   EPDS_INKSET                 = 8;      { inkset match }
  217.  
  218.   EPDS_EQ                     = $0000;  { default: same as }
  219.   EPDS_LT                     = $0010;  { all strokes less than }
  220.   EPDS_GT                     = $0020;  { all strokes greater than }
  221.   EPDS_NOT                    = $0040;  { all strokes not matching }
  222.   EPDS_NE                     = $0040;  { alias }
  223.   EPDS_GTE                    = $0050;  { alias for NOT LT }
  224.   EPDS_LTE                    = $0060;  { alias for NOT GT }
  225.  
  226.   EPDS_REMOVE                 = $8000;  { remove matching strokes from source }
  227.  
  228. { GetPenDataAttributes options (GPA_xx): }
  229.   GPA_MAXLEN                  = 1;  { length of longest stroke }
  230.   GPA_POINTS                  = 2;  { total number of points }
  231.   GPA_PDTS                    = 3;  { PDTS_xx bits }
  232.   GPA_RATE                    = 4;  { get sampling rate }
  233.   GPA_RECTBOUND               = 5;  { bounding rect of all points }
  234.   GPA_RECTBOUNDINK            = 6;  { ditto, adj for fat ink }
  235.   GPA_SIZE                    = 7;  { size of pendata in bytes }
  236.   GPA_STROKES                 = 8;  { total number of strokes }
  237.   GPA_TIME                    = 9;  { absolute time at creation of pendata }
  238.   GPA_USER                    = 10; { number of user bytes available: 0, 1, 2, 4 }
  239.   GPA_VERSION                 = 11; { version number of pendata }
  240.  
  241. { GetStrokeAttributes options (GSA_xx): }
  242.   GSA_PENTIP                  = 1;  { get stroke pentip (color, width, nib) }
  243.   GSA_PENTIPCLASS             = 2;  { same as GSA_PENTIP }
  244.   GSA_USER                    = 3;  { get stroke user value }
  245.   GSA_USERCLASS               = 4;  { get stroke's class user value }
  246.   GSA_TIME                    = 5;  { get time of stroke }
  247.   GSA_SIZE                    = 6;  { get size of stroke in points and bytes }
  248.   GSA_SELECT                  = 7;  { get selection status of stroke }
  249.   GSA_DOWN                    = 8;  { get up/down state of stroke }
  250.   GSA_RECTBOUND               = 9;  { get the bounding rectangle of the stroke }
  251.  
  252. { GetStrokeTableAttributes options (GSA_xx): }
  253.   GSA_PENTIPTABLE             = 10; { get table-indexed pentip }
  254.   GSA_SIZETABLE               = 11; { get count of Stroke Class Table entries }
  255.   GSA_USERTABLE               = 12; { get table-indexed user value }
  256.  
  257.   IX_END                      = $FFFF;  { to or past last available index }
  258.  
  259. { PenTip: }
  260.   PENTIP_NIBDEFAULT           = (0);            { default pen tip nib style }
  261.   PENTIP_HEIGHTDEFAULT        = (0);            { default pen tip nib height }
  262.   PENTIP_OPAQUE               = $FF;            { default opaque ink }
  263.   PENTIP_HILITE               = $80; 
  264.   PENTIP_TRANSPARENT          = (0); 
  265.  
  266. { General PenData API return values (PDR_xx): }
  267.   PDR_NOHIT                   = 3;      { hit test failed }
  268.   PDR_HIT                     = 2;      { hit test succeeded }
  269.   PDR_OK                      = 1;      { success }
  270.   PDR_CANCEL                  = 0;      { callback cancel or impasse }
  271.  
  272.   PDR_ERROR                   = -1;     { parameter or unspecified error }
  273.   PDR_PNDTERR                 = -2;     { bad pendata }
  274.   PDR_VERSIONERR              = -3;     { pendata version error }
  275.   PDR_COMPRESSED              = -4;     { pendata is compressed }
  276.   PDR_STRKINDEXERR            = -5;     { stroke index error }
  277.   PDR_PNTINDEXERR             = -6;     { point index error }
  278.   PDR_MEMERR                  = -7;     { memory error }
  279.   PDR_INKSETERR               = -8;     { bad inkset }
  280.   PDR_ABORT                   = -9;     { pendata has become invalid, e.g. }
  281.   PDR_NA                      = -10;    { option not available (pw kernel) }
  282.  
  283.   PDR_USERDATAERR             = -16;    { user data error }
  284.   PDR_SCALINGERR              = -17;    { scale error }
  285.   PDR_TIMESTAMPERR            = -18;    { timestamp error }
  286.   PDR_OEMDATAERR              = -19;    { OEM data error }
  287.   PDR_SCTERR                  = -20;    { SCT error (full) }
  288.  
  289. { PenData Scaling (PDTS): }
  290.   PDTS_LOMETRIC               = 0;      { 0.01mm }
  291.   PDTS_HIMETRIC               = 1;      { 0.001mm }
  292.   PDTS_HIENGLISH              = 2;      { 0.001" }
  293.   PDTS_STANDARDSCALE          = 2;      { PDTS_HIENGLISH   alias }
  294.   PDTS_DISPLAY                = 3;      { display pixel }
  295.   PDTS_ARBITRARY              = 4;      { app-specific scaling }
  296.   PDTS_SCALEMASK              = $000F;  { scaling values in low nibble }
  297.  
  298. { CompactPenData API trim options: }
  299.   PDTT_DEFAULT                = $0000; 
  300.   PDTT_PENINFO                = $0100; 
  301.   PDTT_UPPOINTS               = $0200; 
  302.   PDTT_OEMDATA                = $0400; 
  303.   PDTT_COLLINEAR              = $0800; 
  304.   PDTT_COLINEAR               = $0800;  { alt sp alias }
  305.   PDTT_DECOMPRESS             = $4000;  { decompress the data }
  306.   PDTT_COMPRESS               = $8000; 
  307.   PDTT_ALL                    = $0F00;  { PENINFO|UPPOINTS|OEMDATA|COLLINEAR }
  308.  
  309.   PHW_NONE                    = $0000;  { no OEMdata }
  310.   PHW_PRESSURE                = $0001;  { report pressure in OEMdata if avail }
  311.   PHW_HEIGHT                  = $0002;  { ditto height }
  312.   PHW_ANGLEXY                 = $0004;  { ditto xy angle }
  313.   PHW_ANGLEZ                  = $0008;  { ditto z angle }
  314.   PHW_BARRELROTATION          = $0010;  { ditto barrel rotation }
  315.   PHW_OEMSPECIFIC             = $0020;  { ditto OEM-specific value }
  316.   PHW_PDK                     = $0040;  { report per-point PDK_xx in OEM data }
  317.   PHW_ALL                     = $007F;  { report everything }
  318.  
  319. { compact pen data trim options: matches PDTT_values (see above) }
  320.   PDTS_COMPRESS2NDDERIV       = $0010;  { compress using 2nd deriv }
  321.   PDTS_COMPRESSMETHOD         = $00F0;  { sum of compress method flags }
  322.   PDTS_NOPENINFO              = $0100;  { removes PENINFO struct from header }
  323.   PDTS_NOUPPOINTS             = $0200;  { remove up pts }
  324.   PDTS_NOOEMDATA              = $0400;  { remove OEM data }
  325.   PDTS_NOCOLLINEAR            = $0800;  { remove successive identical pts }
  326.   PDTS_NOCOLINEAR             = $0800;  { alt sp alias }
  327.   PDTS_NOTICK                 = $1000;  { remove timing info (2.0) }
  328.   PDTS_NOUSER                 = $2000;  { remove user info (2.0) }
  329.   PDTS_NOEMPTYSTROKES         = $4000;  { remove empty strokes (2.0) }
  330.   PDTS_COMPRESSED             = $8000;  { perform lossless compression }
  331.  
  332. { SetStrokeAttributes options (SSA_xx): }
  333.   SSA_PENTIP                  = 1;      { set stroke tip (color, width, nib) }
  334.   SSA_PENTIPCLASS             = 2;      { set stroke's class pentip }
  335.   SSA_USER                    = 3;      { set stroke user value }
  336.   SSA_USERCLASS               = 4;      { set stroke's class user value }
  337.   SSA_TIME                    = 5;      { set time of stroke }
  338.   SSA_SELECT                  = 6;      { set selection status of stroke }
  339.   SSA_DOWN                    = 7;      { set up/down state of stroke }
  340.  
  341. { SetStrokeTableAttributes options (SSA_xx): }
  342.   SSA_PENTIPTABLE             = 8;      { set table-indexed pentip }
  343.   SSA_USERTABLE               = 9;      { set table-indexed user value }
  344.  
  345. { PenTip flag bits: }
  346.   TIP_ERASECOLOR              = 1;      { erase specific color pentip.rgb }
  347.  
  348. { TrimPenData() API options: }
  349.   TPD_RECALCSIZE              = $0000;  { no trim, used for resize calc }
  350.   TPD_USER                    = $0080;  { per-stroke user info }
  351.   TPD_TIME                    = $0100;  { per-stroke timing info }
  352.   TPD_UPPOINTS                = $0200;  { x-y data up points }
  353.   TPD_COLLINEAR               = $0400;  { colinear and coincident points }
  354.   TPD_COLINEAR                = $0400;  { alt sp alias }
  355.   TPD_PENINFO                 = $0800;  { PenInfo struct and all OEM }
  356.   TPD_PHW                     = $1000;  { OEM & pdk except stroke tick or user }
  357.   TPD_OEMDATA                 = $1000;  { ditto }
  358.   TPD_EMPTYSTROKES            = $2000;  { strokes with zero points }
  359.   TPD_EVERYTHING              = $3FFF;  { everything (incl PHW_xx) except down pts }
  360.  
  361.   
  362. { Dictionary: }
  363.  
  364.   cbDictPathMax               = 255; 
  365.   DIRQ_QUERY                  = 1; 
  366.   DIRQ_DESCRIPTION            = 2; 
  367.   DIRQ_CONFIGURE              = 3; 
  368.   DIRQ_OPEN                   = 4; 
  369.   DIRQ_CLOSE                  = 5; 
  370.   DIRQ_SETWORDLISTS           = 6; 
  371.   DIRQ_STRING                 = 7; 
  372.   DIRQ_SUGGEST                = 8; 
  373.   DIRQ_ADD                    = 9; 
  374.   DIRQ_DELETE                 = 10; 
  375.   DIRQ_FLUSH                  = 11; 
  376.   DIRQ_RCCHANGE               = 12; 
  377.   DIRQ_SYMBOLGRAPH            = 13; 
  378.   DIRQ_INIT                   = 14; 
  379.   DIRQ_CLEANUP                = 15; 
  380.   DIRQ_COPYRIGHT              = 16; 
  381.   DIRQ_USER                   = 4096; 
  382.  
  383.   
  384. { Pen driver: }
  385.  
  386.   BITPENUP                    = $8000; 
  387.  
  388. { Pen Driver messages: }
  389.   DRV_SetPenDriverEntryPoints         = DRV_RESERVED+1; 
  390.   DRV_SetEntryPoints                  = DRV_RESERVED+1; { alias }
  391.   DRV_RemovePenDriverEntryPoints      = DRV_RESERVED+2; 
  392.   DRV_RemoveEntryPoints               = DRV_RESERVED+2; { alias }
  393.   DRV_SetPenSamplingRate              = DRV_RESERVED+3; 
  394.   DRV_SetPenSamplingDist              = DRV_RESERVED+4; 
  395.   DRV_GetName                         = DRV_RESERVED+5; 
  396.   DRV_GetVersion                      = DRV_RESERVED+6; 
  397.   DRV_GetPenInfo                      = DRV_RESERVED+7; 
  398.   DRV_PenPlayStart                    = DRV_RESERVED+8; 
  399.   DRV_PenPlayBack                     = DRV_RESERVED+9; 
  400.   DRV_PenPlayStop                     = DRV_RESERVED+10; 
  401.   DRV_GetCalibration                  = DRV_RESERVED+11; 
  402.   DRV_SetCalibration                  = DRV_RESERVED+12; 
  403.   DRV_Reserved1                       = DRV_RESERVED+13; 
  404.   DRV_Reserved2                       = DRV_RESERVED+14; 
  405.   DRV_Query                           = DRV_RESERVED+15; 
  406.   DRV_GetPenSamplingRate              = DRV_RESERVED+16; 
  407.   DRV_Calibrate                       = DRV_RESERVED+17; 
  408.  
  409. { Pen Driver Playback constants: }
  410.   PLAY_VERSION_10_DATA     = 0; 
  411.   PLAY_VERSION_20_DATA     = 1; 
  412.  
  413. { Pen Driver return values: }
  414.   DRV_FAILURE                 = $00000000; 
  415.   DRV_SUCCESS                 = $00000001; 
  416.   DRV_BADPARAM1               = $FFFFFFFF; 
  417.   DRV_BADPARAM2               = $FFFFFFFE; 
  418.   DRV_BADSTRUCT               = $FFFFFFFD; 
  419.  
  420. { Pen Driver register messages flags: }
  421.   PENREG_DEFAULT              = $00000002; 
  422.   PENREG_WILLHANDLEMOUSE      = $00000001; 
  423.  
  424.   MAXOEMDATAWORDS             = 6;            { rgwOemData[MAXOEMDATAWORDS] }
  425.   
  426.   RC_LDEFAULTFLAGS            = $80000000;
  427.  
  428. { Pen Collection Mode termination conditions: }
  429. { (note update doc for PCMINFO struct if change these) }
  430.   PCM_PENUP                   = $00000001;    { stop on penup }
  431.   PCM_RANGE                   = $00000002;    { stop on leaving range }
  432.   PCM_INVERT                  = $00000020;    { stop on tap of opposite end }
  433.   PCM_RECTEXCLUDE             = $00002000;    { click in exclude rect }
  434.   PCM_RECTBOUND               = $00004000;    { click outside bounds rect }
  435.   PCM_TIMEOUT                 = $00008000;    { no activity for timeout ms }
  436. { new for 2.0: }
  437.   PCM_RGNBOUND                = $00010000;    { click outside bounding region }
  438.   PCM_RGNEXCLUDE              = $00020000;    { click in exclude region }
  439.   PCM_DOPOLLING               = $00040000;    { polling mode }
  440.   PCM_TAPNHOLD                = $00080000;    { check for Tap And Hold }
  441.   PCM_ADDDEFAULTS             = RC_LDEFAULTFLAGS; { $80000000 }
  442.  
  443. { Pen Device Capabilities: }
  444.   PDC_INTEGRATED              = $00000001;    { display=digitizer }
  445.   PDC_PROXIMITY               = $00000002;    { detect non-contacting pen }
  446.   PDC_RANGE                   = $00000004;    { event on out-of-range }
  447.   PDC_INVERT                  = $00000008;    { pen opposite end detect }
  448.   PDC_RELATIVE                = $00000010;    { pen driver coords }
  449.   PDC_BARREL1                 = $00000020;    { barrel button 1 present }
  450.   PDC_BARREL2                 = $00000040;    { ditto 2 }
  451.   PDC_BARREL3                 = $00000080;    { ditto 3 }
  452.  
  453. { Pen Driver Kit states: }
  454.   PDK_NULL                    = $0000;  { default to no flags set }
  455.   PDK_UP                      = $0000;  { PDK_NULL alias }
  456.   PDK_DOWN                    = $0001;  { pentip switch ON due to contact }
  457.   PDK_BARREL1                 = $0002;  { barrel1 switch depressed }
  458.   PDK_BARREL2                 = $0004;  { ditto 2 }
  459.   PDK_BARREL3                 = $0008;  { ditto 3 }
  460.   PDK_SWITCHES                = $000F;  { sum of down + barrels 1,2,3 }
  461.   PDK_UNUSED10                = $0020; 
  462.   PDK_UNUSED20                = $0040; 
  463.   PDK_INVERTED                = $0080;  { other end of pen used as tip }
  464.   PDK_PENIDMASK               = $0F00;  { bits 8..11 physical pen id (0..15) }
  465.   PDK_UNUSED1000              = $1000; 
  466.   PDK_INKSTOPPED              = $2000;  { Inking stopped }
  467.   PDK_OUTOFRANGE              = $4000;  { pen left range (OEM data invalid) }
  468.   PDK_DRIVER                  = $8000;  { pen (not mouse) event }
  469.  
  470.   PDK_TIPMASK                 = $0001;  { mask for testing PDK_DOWN }
  471.  
  472. { OEM-specific values for Pen Driver: }
  473.   PDT_NULL                    = 0; 
  474.   PDT_PRESSURE                = 1;      { pressure supported }
  475.   PDT_HEIGHT                  = 2;      { height above tablet }
  476.   PDT_ANGLEXY                 = 3;      { xy (horiz) angle supported }
  477.   PDT_ANGLEZ                  = 4;      { z (vert) angle supported }
  478.   PDT_BARRELROTATION          = 5;      { barrel is rotated }
  479.   PDT_OEMSPECIFIC             = 16;     { max }
  480.  
  481. { Denotes the ID of the current packet }
  482.   PID_CURRENT                 = -1; 
  483.  
  484. { Handwriting Recognizer: }
  485.  
  486. { GetResultsHRC options: }
  487.   GRH_ALL                     = 0;      { get all results }
  488.   GRH_GESTURE                 = 1;      { get only gesture results }
  489.   GRH_NONGESTURE              = 2;      { get all but gesture results }
  490.  
  491. { Gesture sets for EnableGestureSetHRC (bit flags): }
  492.   GST_SEL                     = $00000001;    { sel & lasso }
  493.   GST_CLIP                    = $00000002;    { cut copy paste }
  494.   GST_WHITE                   = $00000004;    { sp tab ret }
  495.   GST_KKCONVERT               = $00000008;    { kkconvert }
  496.   GST_EDIT                    = $00000010;    { insert correct undo clear }
  497.   GST_SYS                     = $00000017;    { all of the above }
  498.   GST_CIRCLELO                = $00000100;    { lowercase circle }
  499.   GST_CIRCLEUP                = $00000200;    { uppercase circle }
  500.   GST_CIRCLE                  = $00000300;    { all circle }
  501.   GST_ALL                     = $00000317;    { all of the above }
  502.  
  503. { General HRC API return values (HRCR_xx): }
  504.   HRCR_NORESULTS              = 4;      { No possible results  to be found }
  505.   HRCR_COMPLETE               = 3;      { finished recognition }
  506.   HRCR_GESTURE                = 2;      { recognized gesture }
  507.   HRCR_OK                     = 1;      { success }
  508.   HRCR_INCOMPLETE             = 0;      { recognizer is processing input }
  509.   HRCR_ERROR                  = -1;     { invalid param or unspecified error }
  510.   HRCR_MEMERR                 = -2;     { memory error }
  511.   HRCR_INVALIDGUIDE           = -3;     { invalid GUIDE struct }
  512.   HRCR_INVALIDPNDT            = -4;     { invalid pendata }
  513.   HRCR_UNSUPPORTED            = -5;     { recognizer does not support feature }
  514.   HRCR_CONFLICT               = -6;     { training conflict }
  515.   HRCR_HOOKED                 = -8;     { hookasaurus ate the result }
  516.  
  517. { system wordlist for AddWordsHWL: }
  518.   HWL_SYSTEM                  = (1);       { magic value means system wordlist }
  519.  
  520. { inkset returns: }
  521.   ISR_ERROR                   = -1;     { Memory or other error }
  522.   ISR_BADINKSET               = -2;     { bad source inkset }
  523.   ISR_BADINDEX                = -3;     { bad inkset index }
  524.  
  525.   MAXHOTSPOT                  = 8;      { max number of hotspots possible }
  526.  
  527. { ProcessHRC time constants: }
  528.   PH_MAX                      = $FFFFFFFF;    { recognize rest of ink }
  529.   PH_DEFAULT                  = $FFFFFFFE;    { reasonable time }
  530.   PH_MIN                      = $FFFFFFFD;    { minimum time }
  531.  
  532. { ResultsHookHRC options: }
  533.   RHH_STD                     = 0;      { GetResultsHRC }
  534.   RHH_BOX                     = 1;      { GetBoxResultsHRC }
  535.  
  536. { SetWordlistCoercionHRC options: }
  537.   SCH_NONE                    = 0;      { turn off coercion }
  538.   SCH_ADVISE                  = 1;      { macro is hint only }
  539.   SCH_FORCE                   = 2;      { some result is forced from macro }
  540.  
  541. { Symbol Context Insert Modes }
  542.   SCIM_INSERT                 = 0;      { insert }
  543.   SCIM_OVERWRITE              = 1;      { overwrite }
  544.  
  545. { SetResultsHookHREC options: }
  546.   SRH_HOOKALL                 = 1;      { hook all recognizers }
  547.  
  548. { SetInternationalHRC options: }
  549.   SSH_RD                      = 1;      { to right and down (English) }
  550.   SSH_RU                      = 2;      { to right and up }
  551.   SSH_LD                      = 3;      { to left and down (Hebrew) }
  552.   SSH_LU                      = 4;      { to left and up }
  553.   SSH_DL                      = 5;      { down and to the left (Chinese) }
  554.   SSH_DR                      = 6;      { down and to the right (Chinese) }
  555.   SSH_UL                      = 7;      { up and to the left }
  556.   SSH_UR                      = 8;      { up and to the right }
  557.  
  558.   SIH_ALLANSICHAR             = 1;      { use all ANSI }
  559.  
  560. { TrainHREC options: }
  561.   TH_QUERY                    = 0;      { query the user if conflict }
  562.   TH_FORCE                    = 1;      { ditto no query }
  563.   TH_SUGGEST                  = 2;      { abandon training if conflict }
  564.  
  565. { Return values for WCR_TRAIN Function }
  566.   TRAIN_NONE                  = $0000; 
  567.   TRAIN_DEFAULT               = $0001; 
  568.   TRAIN_CUSTOM                = $0002; 
  569.   TRAIN_BOTH                  = TRAIN_DEFAULT or TRAIN_CUSTOM; 
  570.  
  571. { Control values for TRAINSAVE }
  572.   TRAIN_SAVE                  = 0;      { save changes that have been made }
  573.   TRAIN_REVERT                = 1;      { discard changes that have been made }
  574.   TRAIN_RESET                 = 2;      { use factory settings }
  575.  
  576. { ConfigRecognizer and ConfigHREC options: }
  577.   WCR_RECOGNAME               = 0;      { ConfigRecognizer 1.0 }
  578.   WCR_QUERY                   = 1; 
  579.   WCR_CONFIGDIALOG            = 2; 
  580.   WCR_DEFAULT                 = 3; 
  581.   WCR_RCCHANGE                = 4; 
  582.   WCR_VERSION                 = 5; 
  583.   WCR_TRAIN                   = 6; 
  584.   WCR_TRAINSAVE               = 7; 
  585.   WCR_TRAINMAX                = 8; 
  586.   WCR_TRAINDIRTY              = 9; 
  587.   WCR_TRAINCUSTOM             = 10; 
  588.   WCR_QUERYLANGUAGE           = 11; 
  589.   WCR_USERCHANGE              = 12; 
  590.  
  591. { ConfigHREC options: }
  592.   WCR_PWVERSION               = 13;     { ver of PenWin recognizer supports }
  593.   WCR_GETALCPRIORITY          = 14;     { get recognizer's ALC priority }
  594.   WCR_SETALCPRIORITY          = 15;     { set recognizer's ALC priority }
  595.   WCR_GETANSISTATE            = 16;     { get ALLANSICHAR state }
  596.   WCR_SETANSISTATE            = 17;     { set ALLANSICHAR if T }
  597.   WCR_GETHAND                 = 18;     { get writing hand }
  598.   WCR_SETHAND                 = 19;     { set writing hand }
  599.   WCR_GETDIRECTION            = 20;     { get writing direction }
  600.   WCR_SETDIRECTION            = 21;     { set writing direction }
  601.   WCR_INITRECOGNIZER          = 22;     { init recognizer and set user name }
  602.   WCR_CLOSERECOGNIZER         = 23;     { close recognizer }
  603.  
  604.   WCR_PRIVATE                 = 1024; 
  605.  
  606. { sub-functions of WCR_USERCHANGE }
  607.   CRUC_NOTIFY                 = 0;      { user name change }
  608.   CRUC_REMOVE                 = 1;      { user name deleted }
  609.  
  610. { Word List Types: }
  611.   WLT_STRING                  = 0;      { one string }
  612.   WLT_STRINGTABLE             = 1;      { array of strings }
  613.   WLT_EMPTY                   = 2;      { empty wordlist }
  614.   WLT_WORDLIST                = 3;      { handle to a wordlist }
  615.  
  616.  
  617. { IEdit Background Options }
  618.  
  619.   IEB_DEFAULT                 = 0;      { default (use COLOR_WINDOW) }
  620.   IEB_BRUSH                   = 1;      { paint background with brush }
  621.   IEB_BIT_UL                  = 2;      { bitmap, upper-left aligned }
  622.   IEB_BIT_CENTER              = 3;      { bitmap, centered in control }
  623.   IEB_BIT_TILE                = 4;      { bitmap, tiled repeatedly in ctl }
  624.   IEB_BIT_STRETCH             = 5;      { bitmap, stretched to fit ctl }
  625.   IEB_OWNERDRAW               = 6;      { parent window will draw background }
  626.  
  627. { IEdit Drawing Options }
  628.   IEDO_NONE                   = $0000;  { no drawing }
  629.   IEDO_FAST                   = $0001;  { ink drawn as fast as possible (def) }
  630.   IEDO_SAVEUPSTROKES          = $0002;  { save upstrokes }
  631.   IEDO_RESERVED               = $FFFC;  { reserved bits }
  632.  
  633. { IEdit Input Options }
  634.   IEI_MOVE                    = $0001;  { move ink into ctl }
  635.   IEI_RESIZE                  = $0002;  { resize ink to fit within ctl }
  636.   IEI_CROP                    = $0004;  { discard ink outside of ctl }
  637.   IEI_DISCARD                 = $0008;  { discard all ink if any outside ctl }
  638.   IEI_RESERVED                = $FFF0;  { reserved }
  639.  
  640. { IEdit IE_GETINK options }
  641.   IEGI_ALL                    = $0000;  { get all ink from control }
  642.   IEGI_SELECTION              = $0001;  { get selected ink from control }
  643.  
  644. { IEdit IE_SETMODE/IE_GETMODE (mode) options }
  645.   IEMODE_READY                = 0;      { default inking, moving, sizing mode }
  646.   IEMODE_ERASE                = 1;      { erasing Mode }
  647.   IEMODE_LASSO                = 2;      { lasso selection mode }
  648.  
  649. { IEdit    Notification Bits }
  650.   IEN_NULL                    = $0000;  { null notification }
  651.   IEN_PDEVENT                 = $0001;  { notify about pointing device events }
  652.   IEN_PAINT                   = $0002;  { send painting-related notifications }
  653.   IEN_FOCUS                   = $0004;  { send focus-related notifications }
  654.   IEN_SCROLL                  = $0008;  { send scrolling notifications }
  655.   IEN_EDIT                    = $0010;  { send editing/change notifications }
  656.   IEN_PROPERTIES              = $0020;  { send properties dialog notification }
  657.   IEN_RESERVED                = $FF80;  { reserved }
  658.  
  659. { IEdit Return Values }
  660.   IER_OK                      = 0;      { success }
  661.   IER_NO                      = 0;      { ctl cannot do request }
  662.   IER_YES                     = 1;      { ctl can do request }
  663.   IER_ERROR                   = -1;     { unspecified error; operation failed }
  664.   IER_PARAMERR                = -2;     { bogus lParam value, bad handle, etc }
  665.   IER_OWNERDRAW               = -3;     { can't set drawopts in ownerdraw ctl }
  666.   IER_SECURITY                = -4;     { security protection disallows action }
  667.   IER_SELECTION               = -5;     { nothing selected in control }
  668.   IER_SCALE                   = -6;     { merge:  incompatible scaling factors }
  669.   IER_MEMERR                  = -7;     { memory error }
  670.   IER_NOCOMMAND               = -8;     { tried IE_GETCOMMAND w/no command }
  671.   IER_NOGESTURE               = -9;     { tried IE_GETGESTURE w/no gesture }
  672.   IER_NOPDEVENT               = -10;    { tried IE_GETPDEVENT but no event }
  673.   IER_NOTINPAINT              = -11;    { tried IE_GETPAINTSTRUCT but no paint }
  674.   IER_PENDATA                 = -12;    { can't do request with NULL hpd in ctl }
  675.  
  676. { IEdit Recognition Options }
  677.   IEREC_NONE                  = $0000;  { No recognition }
  678.   IEREC_GESTURE               = $0001;  { Gesture recognition }
  679. {$DEFINE IEREC_ALL}
  680.   IEREC_RESERVED              = $FFFE;  { Reserved }
  681.  
  682. { IEdit Security Options }
  683.   IESEC_NOCOPY                = $0001;  { copying disallowed }
  684.   IESEC_NOCUT                 = $0002;  { cutting disallowed }
  685.   IESEC_NOPASTE               = $0004;  { pasting disallowed }
  686.   IESEC_NOUNDO                = $0008;  { undoing disallowed }
  687.   IESEC_NOINK                 = $0010;  { inking  disallowed }
  688.   IESEC_NOERASE               = $0020;  { erasing disallowed }
  689.   IESEC_NOGET                 = $0040;  { IE_GETINK message verboten }
  690.   IESEC_NOSET                 = $0080;  { IE_SETINK message verboten }
  691.   IESEC_RESERVED              = $FF00;  { reserved }
  692.  
  693. { IEdit IE_SETFORMAT/IE_GETFORMAT options }
  694.   IESF_ALL                    = $0001;  { set/get stk fmt of all ink }
  695.   IESF_SELECTION              = $0002;  { set/get stk fmt of selected ink }
  696.   IESF_STROKE                 = $0004;  { set/get stk fmt of specified stroke }
  697.  
  698.   IESF_TIPCOLOR               = $0008;  { set color }
  699.   IESF_TIPWIDTH               = $0010;  { set width }
  700.   IESF_PENTIP                 = IESF_TIPCOLOR or IESF_TIPWIDTH; 
  701.  
  702.  
  703. { IEdit IE_SETINK options }
  704.   IESI_REPLACE                = $0000;  { replace ink in control }
  705.   IESI_APPEND                 = $0001;  { append ink to existing control ink }
  706.  
  707. { Ink Edit Control (IEdit) definitions }
  708. { IEdit Notifications }
  709.   IN_PDEVENT          = (IEN_PDEVENT shl 8) or 0; { pointing device event occurred }
  710.   IN_ERASEBKGND       = (IEN_NULL shl 8) or 1; { control needs bkgnd erased }
  711.   IN_PREPAINT         = (IEN_PAINT shl 8) or 2; { before control paints its ink }
  712.   IN_PAINT            = (IEN_NULL shl 8) or 3; { control needs to be painted }
  713.   IN_POSTPAINT        = (IEN_PAINT shl 8) or 4; { after control has painted }
  714.   IN_MODECHANGED      = (IEN_EDIT shl 8) or 5; { mode changed }
  715.   IN_CHANGE           = (IEN_EDIT shl 8) or 6; { contents changed & painted }
  716.   IN_UPDATE           = (IEN_EDIT shl 8) or 7; { contents changed & !painted }
  717.   IN_SETFOCUS         = (IEN_FOCUS shl 8) or 8; { IEdit is getting focus }
  718.   IN_KILLFOCUS        = (IEN_FOCUS shl 8) or 9; { IEdit is losing focus }
  719.   IN_MEMERR           = (IEN_NULL shl 8) or 10; { memory error }
  720.   IN_HSCROLL          = (IEN_SCROLL shl 8) or 11; { horz scrolled, not painted }
  721.   IN_VSCROLL          = (IEN_SCROLL shl 8) or 12; { vert scrolled, not painted }
  722.   IN_GESTURE          = (IEN_EDIT shl 8) or 13; { user has gestured on control }
  723.   IN_COMMAND          = (IEN_EDIT shl 8) or 14; { command selected from menu }
  724.   IN_CLOSE            = (IEN_NULL shl 8) or 15; { I-Edit is being closed }
  725.   IN_PROPERTIES       = (IEN_PROPERTIES shl 8) or 16; { properties dialog }
  726.  
  727.  
  728. { PenIn[k]put API constants }
  729.  
  730. { Default Processing }
  731.   LRET_DONE                   = 1; 
  732.   LRET_ABORT                  = -1; 
  733.   LRET_HRC                    = -2; 
  734.   LRET_HPENDATA               = -3; 
  735.   LRET_PRIVATE                = -4; 
  736.  
  737. { Inkput: }
  738.   PCMR_OK                     = 0; 
  739.   PCMR_ALREADYCOLLECTING      = -1; 
  740.   PCMR_INVALIDCOLLECTION      = -2; 
  741.   PCMR_EVENTLOCK              = -3; 
  742.   PCMR_INVALID_PACKETID       = -4; 
  743.   PCMR_TERMTIMEOUT            = -5; 
  744.   PCMR_TERMRANGE              = -6; 
  745.   PCMR_TERMPENUP              = -7; 
  746.   PCMR_TERMEX                 = -8; 
  747.   PCMR_TERMBOUND              = -9; 
  748.   PCMR_APPTERMINATED          = -10; 
  749.   PCMR_TAP                    = -11;    { alias PCMR_TAPNHOLD_LAST }
  750.   PCMR_SELECT                 = -12;    { ret because of tap & hold }
  751.   PCMR_OVERFLOW               = -13; 
  752.   PCMR_ERROR                  = -14;    { parameter or unspecified error }
  753.   PCMR_DISPLAYERR             = -15;    { inking only }
  754.   PCMR_TERMINVERT             = -16;    { termination due to tapping opposite end of pen }
  755.  
  756.   PII_INKCLIPRECT             = $0001; 
  757.   PII_INKSTOPRECT             = $0002; 
  758.   PII_INKCLIPRGN              = $0004; 
  759.   PII_INKSTOPRGN              = $0008; 
  760.   PII_INKPENTIP               = $0010; 
  761.   PII_SAVEBACKGROUND          = $0020; 
  762.   PII_CLIPSTOP                = $0040; 
  763.  
  764.   PIT_RGNBOUND                = $0001; 
  765.   PIT_RGNEXCLUDE              = $0002; 
  766.   PIT_TIMEOUT                 = $0004; 
  767.   PIT_TAPNHOLD                = $0008; 
  768.  
  769.  
  770. { Misc RC Definitions: }
  771.  
  772.   CL_NULL                     = 0; 
  773.   CL_MINIMUM                  = 1;      { minimum confidence level }
  774.   CL_MAXIMUM                  = 100;    { max (require perfect recog) }
  775.   cwRcReservedMax             = 8;      { rc.rgwReserved[cwRcReservedMax] }
  776.   ENUM_MINIMUM                = 1; 
  777.   ENUM_MAXIMUM                = 4096; 
  778.  
  779.   HKP_SETHOOK                 = 0;      { SetRecogHook() }
  780.   HKP_UNHOOK                  = $FFFF; 
  781.  
  782.   HWR_RESULTS                 = 0; 
  783.   HWR_APPWIDE                 = 1; 
  784.  
  785.   iSycNull                    = -1; 
  786.   LPDFNULL                    = 0;      { nil }
  787.   MAXDICTIONARIES             = 16;     { rc.rglpdf[MAXDICTIONARIES] }
  788.   wPntAll                     = $FFFF; 
  789.   cbRcLanguageMax             = 44;     { rc.lpLanguage[cbRcLanguageMax] }
  790.   cbRcUserMax                 = 32;     { rc.lpUser[cbRcUserMax] }
  791.   cbRcrgbfAlcMax              = 32;     { rc.rgbfAlc[cbRcrgbfAlcMax] }
  792.   RC_WDEFAULT                 = $FFFF; 
  793.   RC_LDEFAULT                 = $FFFFFFFF; 
  794.   RC_WDEFAULTFLAGS            = $8000; 
  795. //  RC_LDEFAULTFLAGS            = $80000000; defined above
  796.  
  797. { CorrectWriting() API constants: }
  798. { LOWORD values: }
  799.   CWR_REPLACECR               = $0001;  { replace carriage ret (\r) with space }
  800.   CWR_STRIPCR                 = CWR_REPLACECR; { alias for backward compatibility }
  801.   CWR_STRIPLF                 = $0002;  { strip linefeed (\n) }
  802.   CWR_REPLACETAB              = $0004;  { replace tab with space (\t) }
  803.   CWR_STRIPTAB                = CWR_REPLACETAB; { alias for backward compatibility }
  804.   CWR_SINGLELINEEDIT          = CWR_REPLACECR or CWR_STRIPLF or CWR_REPLACETAB; { all of the above }
  805.   CWR_INSERT                  = $0008;  { use "Insert Text" instead of "Edit Text" in the title }
  806.   CWR_TITLE                   = $0010;  { interpret dwParam as title string }
  807.   CWR_KKCONVERT               = $0020;  { JPN initiate IME }
  808.   CWR_SIMPLE                  = $0040;  { simple dialog (lens) }
  809.   CWR_HEDIT                   = $0080;  { HEDIT CorrectWriting }
  810.   CWR_KEYBOARD                = $0100;  { keyboard lens }
  811.   CWR_BOXES                   = $0200;  { bedit lens }
  812.  
  813. { HIWORD values: keyboard types }
  814.   CWRK_DEFAULT                = 0;      { default keyboard type }
  815.   CWRK_BASIC                  = 1;      { basic keyboard }
  816.   CWRK_FULL                   = 2;      { full keyboard }
  817.   CWRK_NUMPAD                 = 3;      { numeric keyboard }
  818.   CWRK_TELPAD                 = 4;      { Telephone type keyboard }
  819.  
  820.   GPMI_OK                     = 0; 
  821.   GPMI_INVALIDPMI             = $8000; 
  822.  
  823. { inkwidth limits }
  824.   INKWIDTH_MINIMUM            = 0;          { 0 invisible, 1..15 pixel widths }
  825.   INKWIDTH_MAXIMUM            = 15;         { max width in pixels }
  826.  
  827. { Get/SetPenMiscInfo: }
  828. { PMI_RCCHANGE is for WM_GLOBALRCCHANGE compatability only: }
  829.   PMI_RCCHANGE                = 0;      { invalid for Get/SetPenMiscInfo }
  830.  
  831.   PMI_BEDIT                   = 1;      { boxed edit info }
  832.   PMI_IMECOLOR                = 2;      { input method editor color }
  833.   PMI_CXTABLET                = 3;      { tablet width }
  834.   PMI_CYTABLET                = 4;      { tablet height }
  835.   PMI_PENTIP                  = 6;      { pen tip: color, width, nib }
  836.   PMI_ENABLEFLAGS             = 7;      { PWE_xx enablements }
  837.   PMI_TIMEOUT                 = 8;      { handwriting timeout }
  838.   PMI_TIMEOUTGEST             = 9;      { gesture timeout }
  839.   PMI_TIMEOUTSEL              = 10;     { select (press&hold) timeout }
  840.   PMI_SYSFLAGS                = 11;     { component load configuration }
  841.   PMI_INDEXFROMRGB            = 12;     { color table index from RGB }
  842.   PMI_RGBFROMINDEX            = 13;     { RGB from color table index }
  843.   PMI_SYSREC                  = 14;     { handle to system recognizer }
  844.   PMI_TICKREF                 = 15;     { reference absolute time }
  845.  
  846.   PMI_SAVE                    = $1000;  { save setting to file }
  847.  
  848. { Set/GetPenMiscInfo/PMI_ENABLEFLAGS flags: }
  849.   PWE_AUTOWRITE               = $0001;  { pen functionality where IBeam }
  850.   PWE_ACTIONHANDLES           = $0002;  { action handles in controls }
  851.   PWE_INPUTCURSOR             = $0004;  { show cursor while writing }
  852.   PWE_LENS                    = $0008;  { allow lens popup }
  853.  
  854. { GetPenMiscInfo/PMI_SYSFLAGS flags: }
  855.   PWF_RC1                     = $0001;  { Windows for Pen 1.0 RC support }
  856.   PWF_PEN                     = $0004;  { pen drv loaded & hdwe init'd }
  857.   PWF_INKDISPLAY              = $0008;  { ink-compatible display drv loaded }
  858.   PWF_RECOGNIZER              = $0010;  { system recognizer installed }
  859.   PWF_BEDIT                   = $0100;  { boxed edit support }
  860.   PWF_HEDIT                   = $0200;  { free input edit support }
  861.   PWF_IEDIT                   = $0400;  { ink edit support }
  862.   PWF_ENHANCED                = $1000;  { enh features (gest, 1ms timing) }
  863.   PWF_FULL    = PWF_RC1 or PWF_PEN or PWF_INKDISPLAY or PWF_RECOGNIZER or 
  864.                 PWF_BEDIT or PWF_HEDIT or PWF_IEDIT or PWF_ENHANCED; 
  865.  
  866. { SetPenAppFlags API constants: }
  867.   RPA_DEFAULT                 = $0001;  { = RPA_HEDIT }
  868.   RPA_HEDIT                   = $0001;  { convert EDIT to HEDIT }
  869.   RPA_KANJIFIXEDBEDIT         = $0002; 
  870.   RPA_DBCSPRIORITY            = $0004;  { assume DBCS has priority (Japan) }
  871.  
  872.   PMIR_OK                     = 0; 
  873.   PMIR_INDEX                  = -1; 
  874.   PMIR_VALUE                  = -2; 
  875.   PMIR_INVALIDBOXEDITINFO     = -3; 
  876.   PMIR_INIERROR               = -4; 
  877.   PMIR_ERROR                  = -5; 
  878.   PMIR_NA                     = -6; 
  879.  
  880.   SPMI_OK                     = 0; 
  881.   SPMI_INVALIDBOXEDITINFO     = 1; 
  882.   SPMI_INIERROR               = 2; 
  883.   SPMI_INVALIDPMI             = $8000; 
  884.  
  885.  
  886. { RC Options and Flags: }
  887.  
  888. { RC Direction: }
  889.   RCD_DEFAULT                 = 0;      { def none }
  890.   RCD_LR                      = 1;      { left to right like English }
  891.   RCD_RL                      = 2;      { right to left like Arabic }
  892.   RCD_TB                      = 3;      { top to bottom like Japanese }
  893.   RCD_BT                      = 4;      { bottom to top like some Chinese }
  894.  
  895. { RC International Preferences: }
  896.   RCIP_ALLANSICHAR            = $0001;  { all ANSI chars }
  897.   RCIP_MASK                   = $0001; 
  898.  
  899. { RC Options: }
  900.   RCO_NOPOINTEREVENT          = $00000001;    { no recog tap, tap/hold }
  901.   RCO_SAVEALLDATA             = $00000002;    { save pen data like upstrokes }
  902.   RCO_SAVEHPENDATA            = $00000004;    { save pen data for app }
  903.   RCO_NOFLASHUNKNOWN          = $00000008;    { no ? cursor on unknown }
  904.   RCO_TABLETCOORD             = $00000010;    { tablet coords used in RC }
  905.   RCO_NOSPACEBREAK            = $00000020;    { no space break recog -> dict }
  906.   RCO_NOHIDECURSOR            = $00000040;    { display cursor during inking }
  907.   RCO_NOHOOK                  = $00000080;    { disallow ink hook (passwords) }
  908.   RCO_BOXED                   = $00000100;    { valid rc.guide provided }
  909.   RCO_SUGGEST                 = $00000200;    { for dict suggest }
  910.   RCO_DISABLEGESMAP           = $00000400;    { disable gesture mapping }
  911.   RCO_NOFLASHCURSOR           = $00000800;    { no cursor feedback }
  912.   RCO_BOXCROSS                = $00001000;    { show + at boxedit center }
  913.   RCO_COLDRECOG               = $00008000;    { result is from cold recog }
  914.   RCO_SAVEBACKGROUND          = $00010000;    { Save background from ink }
  915.   RCO_DODEFAULT               = $00020000;    { do default gesture processing }
  916.  
  917. { RC Orientation of Tablet: }
  918.   RCOR_NORMAL                 = 1;      { tablet not rotated }
  919.   RCOR_RIGHT                  = 2;      { rotated 90 deg anticlockwise }
  920.   RCOR_UPSIDEDOWN             = 3;      { rotated 180 deg }
  921.   RCOR_LEFT                   = 4;      { rotated 90 deg clockwise }
  922.  
  923. { RC Preferences: }
  924.   RCP_LEFTHAND                = $0001;  { left handed input }
  925.   RCP_MAPCHAR                 = $0004;  { fill in syg.lpsyc (ink) for training }
  926.  
  927. { RCRESULT wResultsType values: }
  928.   RCRT_DEFAULT                = $0000;  { normal ret }
  929.   RCRT_UNIDENTIFIED           = $0001;  { result contains unidentified results }
  930.   RCRT_GESTURE                = $0002;  { result is a gesture }
  931.   RCRT_NOSYMBOLMATCH          = $0004;  { nothing recognized (no ink match) }
  932.   RCRT_PRIVATE                = $4000;  { recognizer-specific symbol }
  933.   RCRT_NORECOG                = $8000;  { no recog attempted, only data ret }
  934.   RCRT_ALREADYPROCESSED       = $0008;  { GestMgr hooked it }
  935.   RCRT_GESTURETRANSLATED      = $0010;  { GestMgr translated it to ANSI value }
  936.   RCRT_GESTURETOKEYS          = $0020;  { ditto to set of virtual keys }
  937.  
  938. { RC Result Return Mode specification: }
  939.   RRM_STROKE                  = 0;      { return results after each stroke }
  940.   RRM_SYMBOL                  = 1;      { per symbol (e.g. boxed edits) }
  941.   RRM_WORD                    = 2;      { on recog of a word }
  942.   RRM_NEWLINE                 = 3;      { on recog of a line break }
  943.   RRM_COMPLETE                = 16;     { on PCM_xx specified completion }
  944.  
  945.   TPT_CLOSEST                 = $0001;   { Assign to the closest target }
  946.   TPT_INTERSECTINK            = $0002;   { target with intersecting ink }
  947.   TPT_TEXTUAL                 = $0004;   { apply textual heuristics }
  948.   TPT_DEFAULT                 = TPT_TEXTUAL or TPT_INTERSECTINK or TPT_CLOSEST; 
  949.  
  950.  
  951. { Virtual Event Layer: }
  952.   VWM_MOUSEMOVE               = $0001; 
  953.   VWM_MOUSELEFTDOWN           = $0002; 
  954.   VWM_MOUSELEFTUP             = $0004; 
  955.   VWM_MOUSERIGHTDOWN          = $0008; 
  956.   VWM_MOUSERIGHTUP            = $0010; 
  957.  
  958.   
  959. { Messages and Defines }
  960.  
  961.   WM_RCRESULT                 = WM_PENWINFIRST+1;   { $381 }
  962.   WM_HOOKRCRESULT             = WM_PENWINFIRST+2;   { $382 }
  963.   WM_PENMISCINFO              = WM_PENWINFIRST+3;   { $383 }
  964.   WM_GLOBALRCCHANGE           = WM_PENWINFIRST+3;   { alias }
  965.   WM_SKB                      = WM_PENWINFIRST+4;   { $384 }
  966.   WM_PENCTL                   = WM_PENWINFIRST+5;   { $385 }
  967.   WM_HEDITCTL                 = WM_PENWINFIRST+5;   { FBC: alias }
  968.  
  969. { WM_HEDITCTL (WM_PENCTL) wParam options: }
  970.   HE_GETRC                    = 3;      { FBC: get RC from HEDIT/BEDIT control }
  971.   HE_SETRC                    = 4;      { FBC: ditto set }
  972.   HE_GETINFLATE               = 5;      { FBC: get inflate rect }
  973.   HE_SETINFLATE               = 6;      { FBC: ditto set }
  974.   HE_GETUNDERLINE             = 7;      { get underline mode }
  975.   HE_SETUNDERLINE             = 8;      { ditto set }
  976.   HE_GETINKHANDLE             = 9;      { get handle to captured ink }
  977.   HE_SETINKMODE               = 10;     { begin HEDIT cold recog mode }
  978.   HE_STOPINKMODE              = 11;     { end cold recog mode }
  979.   HE_GETRCRESULTCODE          = 12;     { FBC: result of recog after HN_ENDREC }
  980.   HE_DEFAULTFONT              = 13;     { switch BEDIT to def font }
  981.   HE_CHARPOSITION             = 14;     { BEDIT byte offset -> char position }
  982.   HE_CHAROFFSET               = 15;     { BEDIT char position -> byte offset }
  983.   HE_GETBOXLAYOUT             = 20;     { get BEDIT layout }
  984.   HE_SETBOXLAYOUT             = 21;     { ditto set }
  985.   HE_GETRCRESULT              = 22;     { FBC: get RCRESULT after HN_RCRESULT }
  986.   HE_KKCONVERT                = 30;     { JPN start kana-kanji conversion }
  987.   HE_GETKKCONVERT             = 31;     { JPN get KK state }
  988.   HE_CANCELKKCONVERT          = 32;     { JPN cancel KK conversion }
  989.   HE_FIXKKCONVERT             = 33;     { JPN force KK result }
  990.   HE_GETKKSTATUS              = 34;     { JPN get KK UI state }
  991.   HE_KKNOCONVERT              = 35;     { JPN revert conversion }
  992.   HE_SETIMEDEFAULT            = 36;     { JPN set a range of DCS }
  993.   HE_GETIMEDEFAULT            = 37;     { JPN get a range of DCS }
  994.   HE_ENABLEALTLIST            = 40;     { en/disable dropdown recog alt's }
  995.   HE_SHOWALTLIST              = 41;     { show dropdown (assume enabled) }
  996.   HE_HIDEALTLIST              = 42;     { hide dropdown alternatives }
  997.   HE_GETLENSTYPE              = 43;     { get lens type: CWR_ and CWRK_ flags }
  998.   HE_SETLENSTYPE              = 44;     { set lens type: CWR_ and CWRK_ flags }
  999.  
  1000. { JPN Kana-to-Kanji conversion subfunctions: }
  1001.   HEKK_DEFAULT                = 0;      { def }
  1002.   HEKK_CONVERT                = 1;      { convert in place }
  1003.   HEKK_CANDIDATE              = 2;      { start conversion dialog }
  1004.   HEKK_DBCSCHAR               = 3;      { convert to DBCS }
  1005.   HEKK_SBCSCHAR               = 4;      { convert to SBCS }
  1006.   HEKK_HIRAGANA               = 5;      { convert to hiragana }
  1007.   HEKK_KATAKANA               = 6;      { convert to katakana }
  1008.  
  1009. { JPN Return value of HE_GETKKSTATUS }
  1010.   HEKKR_PRECONVERT            = 1;      { in pre conversion mode }
  1011.   HEKKR_CONVERT               = 2;      { in mid conversion mode }
  1012.   HEKKR_TEMPCONFIRM           = 3;      { in post conversion mode }
  1013.  
  1014. { HE_STOPINKMODE (stop cold recog) options: }
  1015.   HEP_NORECOG                 = 0;      { don't recog ink }
  1016.   HEP_RECOG                   = 1;      { recog ink }
  1017.   HEP_WAITFORTAP              = 2;      { recog after tap in window }
  1018.  
  1019. { WM_PENCTL notifications: }
  1020.   HN_ENDREC                   = 4;      { recog complete }
  1021.   HN_DELAYEDRECOGFAIL         = 5;      { HE_STOPINKMODE (cold recog) failed }
  1022.   HN_RESULT                   = 20;     { HEDIT/BEDIT has received new ink/recognition result }
  1023.   HN_RCRESULT                 = HN_RESULT; 
  1024.   HN_ENDKKCONVERT             = 30;     { JPN KK conversion complete }
  1025.   HN_BEGINDIALOG              = 40;     { Lens/EditText/garbage detection dialog }
  1026. {  is about to come up on this hedit/bedit }
  1027.   HN_ENDDIALOG                = 41;     { Lens/EditText/garbage detection dialog }
  1028. {  has just been destroyed }
  1029.  
  1030.  
  1031. { Messages common with other controls: }
  1032.  
  1033.   IE_GETMODIFY          = EM_GETMODIFY;        { gets the mod'n (dirty) bit }
  1034.   IE_SETMODIFY          = EM_SETMODIFY;        { sets the mod'n (dirty) bit }
  1035.   IE_CANUNDO            = EM_CANUNDO;          { queries whether can undo }
  1036.   IE_UNDO               = EM_UNDO;             { undo }
  1037.   IE_EMPTYUNDOBUFFER    = EM_EMPTYUNDOBUFFER;  { clears IEDIT undo buffer }
  1038.   IE_MSGFIRST           = WM_USER+150;         { $496 = 1174 }
  1039.  
  1040. { IEdit common messages: }
  1041.   IE_GETINK                 = IE_MSGFIRST+0;    { gets ink from the control }
  1042.   IE_SETINK                 = IE_MSGFIRST+1;    { sets ink into the control }
  1043.   IE_GETPENTIP              = IE_MSGFIRST+2;    { gets the cur def ink pentip }
  1044.   IE_SETPENTIP              = IE_MSGFIRST+3;    { sets the cur def ink pentip }
  1045.   IE_GETERASERTIP           = IE_MSGFIRST+4;    { gets the cur eraser pentip }
  1046.   IE_SETERASERTIP           = IE_MSGFIRST+5;    { sets the cur eraser pentip }
  1047.   IE_GETBKGND               = IE_MSGFIRST+6;    { gets the bkgnd options }
  1048.   IE_SETBKGND               = IE_MSGFIRST+7;    { sets the bkgnd options }
  1049.   IE_GETGRIDORIGIN          = IE_MSGFIRST+8;    { gets the bkgnd grid origin }
  1050.   IE_SETGRIDORIGIN          = IE_MSGFIRST+9;    { sets the bkgnd grid origin }
  1051.   IE_GETGRIDPEN             = IE_MSGFIRST+10;   { gets the bkgnd grid pen }
  1052.   IE_SETGRIDPEN             = IE_MSGFIRST+11;   { sets the bkgnd grid pen }
  1053.   IE_GETGRIDSIZE            = IE_MSGFIRST+12;   { gets the bkgnd grid size }
  1054.   IE_SETGRIDSIZE            = IE_MSGFIRST+13;   { sets the bkgnd grid size }
  1055.   IE_GETMODE                = IE_MSGFIRST+14;   { gets the current pen mode }
  1056.   IE_SETMODE                = IE_MSGFIRST+15;   { sets the current pen mode }
  1057.   IE_GETINKRECT             = IE_MSGFIRST+16;   { gets the rectbound of the ink }
  1058.  
  1059. { IEdit-specific messages: }
  1060.   IE_GETAPPDATA             = IE_MSGFIRST+34;   { gets the user-defined datum }
  1061.   IE_SETAPPDATA             = IE_MSGFIRST+35;   { sets the user-defined data }
  1062.   IE_GETDRAWOPTS            = IE_MSGFIRST+36;   { gets the ink draw options }
  1063.   IE_SETDRAWOPTS            = IE_MSGFIRST+37;   { sets the ink options }
  1064.   IE_GETFORMAT              = IE_MSGFIRST+38;   { gets format of stroke(s) }
  1065.   IE_SETFORMAT              = IE_MSGFIRST+39;   { sets format of stroke(s) }
  1066.   IE_GETINKINPUT            = IE_MSGFIRST+40;   { gets the ink input option }
  1067.   IE_SETINKINPUT            = IE_MSGFIRST+41;   { sets the ink input option }
  1068.   IE_GETNOTIFY              = IE_MSGFIRST+42;   { gets the notification bits }
  1069.   IE_SETNOTIFY              = IE_MSGFIRST+43;   { sets the notification bits }
  1070.   IE_GETRECOG               = IE_MSGFIRST+44;   { gets recognition options }
  1071.   IE_SETRECOG               = IE_MSGFIRST+45;   { sets recognition options }
  1072.   IE_GETSECURITY            = IE_MSGFIRST+46;   { gets the security options }
  1073.   IE_SETSECURITY            = IE_MSGFIRST+47;   { sets the security options }
  1074.   IE_GETSEL                 = IE_MSGFIRST+48;   { gets sel status of a stroke }
  1075.   IE_SETSEL                 = IE_MSGFIRST+49;   { sets sel status of a stroke }
  1076.   IE_DOCOMMAND              = IE_MSGFIRST+50;   { send command to IEdit }
  1077.   IE_GETCOMMAND             = IE_MSGFIRST+51;   { gets user command }
  1078.   IE_GETCOUNT               = IE_MSGFIRST+52;   { gets count of strks in I-Edit }
  1079.   IE_GETGESTURE             = IE_MSGFIRST+53;   { gets details on user gesture }
  1080.   IE_GETMENU                = IE_MSGFIRST+54;   { gets handle to pop-up menu }
  1081.   IE_GETPAINTDC             = IE_MSGFIRST+55;   { gets the HDC for painting }
  1082.   IE_GETPDEVENT             = IE_MSGFIRST+56;   { gets details of last pd event }
  1083.   IE_GETSELCOUNT            = IE_MSGFIRST+57;   { gets count of selected strks }
  1084.   IE_GETSELITEMS            = IE_MSGFIRST+58;   { gets indices of all sel strks }
  1085.   IE_GETSTYLE               = IE_MSGFIRST+59;   { gets IEdit control styles }
  1086.  
  1087.  
  1088. { (H)Edit Control: }
  1089.  
  1090. { CTLINITHEDIT.dwFlags values }
  1091.   CIH_NOGDMSG               = $0001;  { disable garbage detection message box for this edit }
  1092.   CIH_NOACTIONHANDLE        = $0002;  { disable action handles for this edit }
  1093.   CIH_NOEDITTEXT            = $0004;  { disable Lens/Edit/Insert text for this edit }
  1094.   CIH_NOFLASHCURSOR         = $0008;  { don't flash cursor on tap-n-hold in this (h)edit }
  1095.  
  1096.  
  1097. { Boxed Edit Control: }
  1098.  
  1099. { box edit alternative list: }
  1100.   HEAL_DEFAULT                = -1;     { AltList def value for lParam }
  1101.  
  1102. { box edit Info: }
  1103.   BEI_FACESIZE                = 32;     { max size of font name, = LF_FACESIZE }
  1104.   BEIF_BOXCROSS               = $0001; 
  1105.  
  1106. { box edit size: }
  1107.   BESC_DEFAULT                = 0; 
  1108.   BESC_ROMANFIXED             = 1; 
  1109.   BESC_KANJIFIXED             = 2; 
  1110.   BESC_USERDEFINED            = 3; 
  1111.  
  1112. { CTLINITBEDIT.wFlags values }
  1113.   CIB_NOGDMSG               = $0001;  { disable garbage detection message box for this bedit }
  1114.   CIB_NOACTIONHANDLE        = $0002;  { disable action handles for this bedit }
  1115.   CIB_NOFLASHCURSOR         = $0004;  { don't flash cursor on tap-n-hold in this bedit }
  1116.   CIB_NOWRITING             = $0010;  { disallow pen input into control }
  1117.  
  1118.   BXD_CELLWIDTH               = 12; 
  1119.   BXD_CELLHEIGHT              = 16; 
  1120.   BXD_BASEHEIGHT              = 13; 
  1121.   BXD_BASEHORZ                = 0; 
  1122.   BXD_MIDFROMBASE             = 0; 
  1123.   BXD_CUSPHEIGHT              = 2; 
  1124.   BXD_ENDCUSPHEIGHT           = 4; 
  1125.  
  1126.   BXDK_CELLWIDTH              = 32; 
  1127.   BXDK_CELLHEIGHT             = 32; 
  1128.   BXDK_BASEHEIGHT             = 28; 
  1129.   BXDK_BASEHORZ               = 0; 
  1130.   BXDK_MIDFROMBASE            = 0; 
  1131.   BXDK_CUSPHEIGHT             = 28; 
  1132.   BXDK_ENDCUSPHEIGHT          = 10; 
  1133.  
  1134. { IME colors for bedit }
  1135.   COLOR_BE_INPUT                 = 0; 
  1136.   COLOR_BE_INPUT_TEXT            = 1; 
  1137.   COLOR_BE_CONVERT               = 2; 
  1138.   COLOR_BE_CONVERT_TEXT          = 3; 
  1139.   COLOR_BE_CONVERTED             = 4; 
  1140.   COLOR_BE_CONVERTED_TEXT        = 5; 
  1141.   COLOR_BE_UNCONVERT             = 6; 
  1142.   COLOR_BE_UNCONVERT_TEXT        = 7; 
  1143.   COLOR_BE_CURSOR                = 8; 
  1144.   COLOR_BE_CURSOR_TEXT           = 9; 
  1145.   COLOR_BE_PRECONVERT            = 10; 
  1146.   COLOR_BE_PRECONVERT_TEXT       = 11; 
  1147.   MAXIMECOLORS                   = 12; 
  1148.  
  1149.   WM_PENMISC                  = WM_PENWINFIRST+6;   { $386 }
  1150.  
  1151. { WM_PENMISC message constants: }
  1152.   PMSC_BEDITCHANGE            = 1;      { broadcast when BEDIT changes }
  1153.   PMSC_PENUICHANGE            = 2;      { JPN broadcast when PENUI changes }
  1154.   PMSC_SUBINPCHANGE           = 3;      { JPN broadcast when SUBINPUT changes }
  1155.   PMSC_KKCTLENABLE            = 4;      { JPN }
  1156.   PMSC_GETPCMINFO             = 5;      { query the window's PCMINFO }
  1157.   PMSC_SETPCMINFO             = 6;      { set the window's PCMINFO }
  1158.   PMSC_GETINKINGINFO          = 7;      { query the window's INKINGINFO }
  1159.   PMSC_SETINKINGINFO          = 8;      { set the window's INKINGINFO }
  1160.   PMSC_GETHRC                 = 9;      { query the window's HRC }
  1161.   PMSC_SETHRC                 = 10;     { set the window's HRC }
  1162.   PMSC_GETSYMBOLCOUNT         = 11;     { count of symbols in result recd by window }
  1163.   PMSC_GETSYMBOLS             = 12;     { ditto symbols }
  1164.   PMSC_SETSYMBOLS             = 13;     { ditto set symbols }
  1165.   PMSC_LOADPW                 = 15;     { broadcast load state on penwin }
  1166.   PMSC_INKSTOP                = 16; 
  1167.  
  1168. { PMSCL_xx lParam values for PMSC_xx: }
  1169.   PMSCL_UNLOADED              = 0;      { penwin just unloaded }
  1170.   PMSCL_LOADED                = 1;      { penwin just loaded }
  1171.   PMSCL_UNLOADING             = 2;      { penwin about to unload }
  1172.  
  1173.   WM_CTLINIT                  = WM_PENWINFIRST+7;   { $387 }
  1174.  
  1175. { WM_CTLINIT message constants: }
  1176.   CTLINIT_HEDIT               = 1; 
  1177.   CTLINIT_BEDIT               = 7; 
  1178.   CTLINIT_IEDIT               = 9; 
  1179.   CTLINIT_MAX                 = 10; 
  1180.  
  1181.   WM_PENEVENT                 = WM_PENWINFIRST+8;   { $388 }
  1182.  
  1183. { WM_PENEVENT message values for wParam: }
  1184.   PE_PENDOWN                  = 1;      { pen tip down }
  1185.   PE_PENUP                    = 2;      { pen tip went from down to up }
  1186.   PE_PENMOVE                  = 3;      { pen moved without a tip transition }
  1187.   PE_TERMINATING              = 4;      { Peninput about to terminate }
  1188.   PE_TERMINATED               = 5;      { Peninput terminated }
  1189.   PE_BUFFERWARNING            = 6;      { Buffer half full. }
  1190.   PE_BEGININPUT               = 7;      { begin default input }
  1191.   PE_SETTARGETS               = 8;      { set target data structure (TARGINFO) }
  1192.   PE_BEGINDATA                = 9;      { init message to all targets }
  1193.   PE_MOREDATA                 = 10;     { target gets more data }
  1194.   PE_ENDDATA                  = 11;     { termination message to all targets }
  1195.   PE_GETPCMINFO               = 12;     { get input collection info }
  1196.   PE_GETINKINGINFO            = 13;     { get inking info }
  1197.   PE_ENDINPUT                 = 14;     { Input termination message to window }
  1198. { starting default input }
  1199.   PE_RESULT                   = 15;     { sent after ProcessHRC but before GetResultsHRC }
  1200.  
  1201. type
  1202.   HTRG = Integer;
  1203.   HPCM = Integer;
  1204.   HPENDATA = Integer;
  1205.   HREC = Integer;
  1206.   
  1207.   
  1208. { Types }
  1209.  
  1210. { Simple: }
  1211. type
  1212.   ALC = Longint;                                { Enabled Alphabet }
  1213.   CL = Integer;                              { Confidence Level }
  1214.   HKP = UINT;                                { Hook Parameter }
  1215.   REC = Integer;                             { recognition result }
  1216.   SYV = Longint;                                { Symbol Value }
  1217.  
  1218. { Pointer Types: }
  1219. type
  1220.   PALC = ^ALC;                                      { ptr to ALC }
  1221.   POEM = Pointer;                                   { alias }
  1222.   PSYV = ^SYV;                                      { ptr to SYV }
  1223.   PHPENDATA = ^HPENDATA;                            { ptr to HPENDATA }
  1224.  
  1225. { Function Prototypes: }
  1226.   TFNEnumProc = function(p1: PSYV; p2: Integer; p3: Integer): Integer stdcall;
  1227.   PFNLPDF = ^TFNLPDF;
  1228.   TFNLPDF = function(p1: Integer; p2, p3: Pointer; p4: Integer; 
  1229.     p5, p6: DWORD): Integer stdcall;
  1230.   TFNRCYieldProc = function: BOOL stdcall;
  1231.  
  1232.   
  1233. { Structures: }
  1234.  
  1235.   PAbsTime = ^TAbsTime;
  1236.   TAbsTime = packed record    { 2.0 absolute date/time }
  1237.     sec: DWORD;    { number of seconds since 1/1/1970, ret by CRTlib time() fn }
  1238.     ms: UINT;      { additional offset in ms, 0..999 }
  1239.   end;
  1240.  
  1241.   PCtlInitHEdit = ^TCtlInitHEdit;
  1242.   TCtlInitHEdit = packed record { 2.0 init struct for (h)edit }
  1243.     cbSize: DWORD;              { sizeof(CTLINITHEDIT) }
  1244.     hwnd: HWND;                 { (h)edit window handle }
  1245.     id: Integer;                    { its id }
  1246.     dwFlags: DWORD;             { CIE_xx }
  1247.     dwReserved: DWORD;          { for future use }
  1248.   end;
  1249.  
  1250.   PBoxLayout = ^TBoxLayout;
  1251.   TBoxLayout = packed record  { 1.0 box edit layout }
  1252.     cyCusp: Integer;                { pixel height of box (BXS_RECT) or cusp }
  1253.     cyEndCusp: Integer;             { pixel height of cusps at extreme ends }
  1254.     style: UINT;                { BXS_xx style }
  1255.     dwReserved1: DWORD;         { reserved }
  1256.     dwReserved2: DWORD;         { reserved }
  1257.     dwReserved3: DWORD;         { reserved }
  1258.   end;
  1259.  
  1260.   PIMEColors = ^TIMEColors;
  1261.   TIMEColors = packed record  { 2.0 IME undetermined string color info. }
  1262.     cColors: Integer;               { count of colors to be set/get }
  1263.     lpnElem: PINT;             { address of array of elements }
  1264.     lprgbIme: ^COLORREF;        { address of array of RGB values }
  1265.   end;
  1266.  
  1267.   PCtlInitBEdit = ^TCtlInitBEdit;
  1268.   TCtlInitBEdit = packed record { 2.0 init struct for box edit }
  1269.     cbSize: DWORD;              { sizeof(CTLINITBEDIT) }
  1270.     hwnd: HWND;                 { box edit window handle }
  1271.     id: Integer;                    { its id }
  1272.     wSizeCategory: WORD;        { BESC_xx }
  1273.     wFlags: WORD;               { CIB_xx }
  1274.     dwReserved: DWORD;          { for future use }
  1275.   end;
  1276.  
  1277.   PBoxEditInfo = ^TBoxEditInfo;
  1278.   TBoxEditInfo = packed record { 1.1 box edit Size Info }
  1279.     cxBox: Integer;                 { width of a single box }
  1280.     cyBox: Integer;                 { ditto height }
  1281.     cxBase: Integer;                { in-box x-margin to guideline }
  1282.     cyBase: Integer;                { in-box y offset from top to baseline }
  1283.     cyMid: Integer;                 { 0 or distance from baseline to midline }
  1284.     boxlayout: TBoxLayout;       { embedded BOXLAYOUT structure }
  1285.     wFlags: UINT;               { BEIF_xx }
  1286.     szFaceName: packed array[0..BEI_FACESIZE-1] of BYTE;{ font face name }
  1287.     wFontHeight: UINT;          { font height }
  1288.     rgwReserved: packed array[0..7] of UINT;{ for future use }
  1289.   end;
  1290.  
  1291.   PRectOfs = ^TRectOfs;
  1292.   TRectOfs = packed record    { 1.0 rectangle offset for nonisometric inflation }
  1293.     dLeft: Integer;                 { inflation leftwards from left side }
  1294.     dTop: Integer;                  { ditto upwards from top }
  1295.     dRight: Integer;                { ditto rightwards from right }
  1296.     dBottom: Integer;               { ditto downwards from bottom }
  1297.   end;
  1298.  
  1299.   PPenDataHeader = ^TPenDataHeader;
  1300.   TPenDataHeader = packed record { 1.0 main pen data header }
  1301.     wVersion: UINT;             { pen data format version }
  1302.     cbSizeUsed: UINT;           { size of pendata mem block in bytes }
  1303.     cStrokes: UINT;             { number of strokes (incl up-strokes) }
  1304.     cPnt: UINT;                 { count of all points }
  1305.     cPntStrokeMax: UINT;        { length (in points) of longest stroke }
  1306.     rectBound: TRect;            { bounding rect of all down points }
  1307.     wPndts: UINT;               { PDTS_xx bits }
  1308.     nInkWidth: Integer;             { ink width in pixels }
  1309.     rgbInk: DWORD;              { ink color }
  1310.   end;
  1311.  
  1312.   PStrokeInfo = ^TStrokeInfo;
  1313.   TStrokeInfo = packed record { 1.0 stroke header }
  1314.     cPnt: UINT;                 { count of points in stroke }
  1315.     cbPnts: UINT;               { size of stroke in bytes }
  1316.     wPdk: UINT;                 { state of stroke }
  1317.     dwTick: DWORD;              { time at beginning of stroke }
  1318.   end;
  1319.  
  1320.   PPenTip = ^TPenTip;
  1321.   TPenTip = packed record     { 2.0 Pen Tip characteristics }
  1322.     cbSize: DWORD;              { sizeof(PENTIP) }
  1323.     btype: BYTE;                { pen type/nib (calligraphic nib, etc.) }
  1324.     bwidth: BYTE;               { width of Nib (typically = nInkWidth) }
  1325.     bheight: BYTE;              { height of Nib }
  1326.     bOpacity: BYTE;             { 0=transparent, $80=hilite, $FF=opaque }
  1327.     rgb: COLORREF;              { pen color }
  1328.     dwFlags: DWORD;             { TIP_xx flags }
  1329.     dwReserved: DWORD;          { for future expansion }
  1330.   end;
  1331.  
  1332.   TFNAnimateProc = function(p1: HPENDATA; p2, p3: UINT; p4: PUINT; 
  1333.     p5: LPARAM): BOOL stdcall;
  1334.  
  1335.   PAnimateInfo = ^TAnimateInfo;
  1336.   TAnimateInfo = packed record { 2.0 Animation parameters }
  1337.     cbSize: DWORD;              { sizeof(ANIMATEINFO) }
  1338.     uSpeedPct: UINT;            { speed percent to animate at }
  1339.     uPeriodCB: UINT;            { time between calls to callback in ms }
  1340.     fuFlags: UINT;              { animation flags }
  1341.     lParam: LPARAM;             { value to pass to callback }
  1342.     dwReserved: DWORD;          { reserved }
  1343.   end;
  1344.  
  1345.   POEMPenInfo = ^TOEMPenInfo;
  1346.   TOEMPenInfo = packed record { 1.0 OEM pen/tablet hdwe info }
  1347.     wPdt: UINT;                 { pen data type }
  1348.     wValueMax: UINT;            { largest val ret by device }
  1349.     wDistinct: UINT;            { number of distinct readings possible }
  1350.   end;
  1351.  
  1352.   PPenPacket = ^TPenPacket;
  1353.   TPenPacket = packed record
  1354.     wTabletX: UINT;             { x in raw coords }
  1355.     wTabletY: UINT;             { ditto y }
  1356.     wPDK: UINT;                 { state bits }
  1357.     rgwOemData: packed array[0..MAXOEMDATAWORDS-1] of UINT;{ OEM-specific data }
  1358.   end;
  1359.  
  1360.   POEMPenPacket = ^TOEMPenPacket;
  1361.   TOEMPenPacket = packed record
  1362.     wTabletX: UINT;             { x in raw coords }
  1363.     wTabletY: UINT;             { ditto y }
  1364.     wPDK: UINT;                 { state bits }
  1365.     rgwOemData: packed array[0..MAXOEMDATAWORDS-1] of UINT;{ OEM-specific data }
  1366.     dwTime: DWORD;
  1367.   end;
  1368.  
  1369.   PPenInfo = ^TPenInfo;
  1370.   TPenInfo = packed record    { 1.0 pen/tablet hdwe info }
  1371.     cxRawWidth: UINT;           { max x coord and tablet width in 0.001" }
  1372.     cyRawHeight: UINT;          { ditto y, height }
  1373.     wDistinctWidth: UINT;       { number of distinct x values tablet ret }
  1374.     wDistinctHeight: UINT;      { ditto y }
  1375.     nSamplingRate: Integer;         { samples / second }
  1376.     nSamplingDist: Integer;         { min distance to move before generating event }
  1377.     lPdc: Longint;                 { Pen Device Capabilities }
  1378.     cPens: Integer;                 { number of pens supported }
  1379.     cbOemData: Integer;             { width of OEM data packet }
  1380.     rgoempeninfo: packed array[0..MAXOEMDATAWORDS-1] of TOEMPenInfo;{ supported OEM data types }
  1381.     rgwReserved: packed array[0..6] of UINT;{ for internal use }
  1382.     fuOEM: UINT;                { which OEM data, timing, PDK_xx to report }
  1383.   end;
  1384.  
  1385.   PCalbStruct = ^TCalbStruct;
  1386.   TCalbStruct = packed record { 1.0 pen calibration }
  1387.     wOffsetX: Integer;
  1388.     wOffsetY: Integer;
  1389.     wDistinctWidth: Integer;
  1390.     wDistinctHeight: Integer;
  1391.   end;
  1392.  
  1393.   TFNRawHook = function(PenPacket: PPenPacket): BOOL stdcall;
  1394.  
  1395.  
  1396. { Handwriting Recognizer: }
  1397.  
  1398. type
  1399.   HRC = Integer;
  1400.   HRCRESULT = Integer;
  1401.   HWL = Integer;
  1402.   HRECHOOK = Integer;
  1403.   HINKSET = Integer;
  1404.  
  1405.   PHRC = ^HRC; 
  1406.   PHRCRESULT = ^HRCRESULT; 
  1407.   PHWL = ^HWL; 
  1408.  
  1409.   TFNHRCResultHookProc = function(p1: HREC; p2: HRC; p3, p4, p5: UINT; 
  1410.     p6: Pointer): BOOL stdcall;
  1411.  
  1412. { Inksets: }
  1413.  
  1414.   LPHINKSET = ^HINKSET;                                    { ptr to HINKSET }
  1415.  
  1416.   PInterval = ^TInterval;
  1417.   TInterval = packed record   { 2.0 interval structure for inksets }
  1418.     atBegin: TAbsTime;           { begining of 1-ms granularity interval }
  1419.     atEnd: TAbsTime;             { 1 ms past end of interval }
  1420.   end;
  1421.  
  1422.   PBoxResults = ^TBoxResults;
  1423.   TBoxResults = packed record { 2.0 }
  1424.     indxBox: UINT;
  1425.     hinksetBox: HINKSET;
  1426.     rgSyv: packed array[0..0] of SYV;
  1427.   end;
  1428.  
  1429.   PGuide = ^TGuide;
  1430.   TGuide = packed record      { 1.0 guide structure }
  1431.     xOrigin: Integer;               { left edge of first box (screen coord)) }
  1432.     yOrigin: Integer;               { ditto top edge }
  1433.     cxBox: Integer;                 { width of a single box }
  1434.     cyBox: Integer;                 { ditto height }
  1435.     cxBase: Integer;                { in-box x-margin to guideline }
  1436.     cyBase: Integer;                { in-box y offset from top to baseline }
  1437.     cHorzBox: Integer;              { count of boxed columns }
  1438.     cVertBox: Integer;              { ditto rows }
  1439.     cyMid: Integer;                 { 0 or distance from baseline to midline }
  1440.   end;
  1441.  
  1442.   PCtlInitIEdit = ^TCtlInitIEdit;
  1443.   TCtlInitIEdit = packed record { 2.0 init struct for Ink Edit }
  1444.     cbSize: DWORD;              { sizeof(CTLINITIEDIT) }
  1445.     hwnd: HWND;                 { IEdit window handle }
  1446.     id: Integer;                    { its ID }
  1447.     ieb: WORD;                  { IEB_* (background) bits }
  1448.     iedo: WORD;                 { IEDO_* (draw options) bits }
  1449.     iei: WORD;                  { IEI_* (ink input) bits }
  1450.     ien: WORD;                  { IEN_* (notification) bits }
  1451.     ierec: WORD;                { IEREC_* (recognition) bits }
  1452.     ies: WORD;                  { IES_* (style) bits }
  1453.     iesec: WORD;                { IESEC_* (security) bits }
  1454.     pdts: WORD;                 { initial pendata scale factor (PDTS_*) }
  1455.     hpndt: HPENDATA;            { initial pendata (or NULL if none) }
  1456.     hgdiobj: HGDIOBJ;           { background brush or bitmap handle }
  1457.     hpenGrid: HPEN;             { pen to use in drawing grid }
  1458.     ptOrgGrid: TPoint;          { grid lines point of origin }
  1459.     wVGrid: WORD;               { vertical gridline spacing }
  1460.     wHGrid: WORD;               { horizontal gridline spacing }
  1461.     dwApp: DWORD;               { application-defined data }
  1462.     dwReserved: DWORD;          { reserved for future use }
  1463.   end;
  1464.  
  1465.   PPDEvent = ^TPDEvent;
  1466.   TPDEvent = packed record    { 2.0 }
  1467.     cbSize: DWORD;              { sizeof(PDEVENT) }
  1468.     hwnd: HWND;                 { window handle of I-Edit }
  1469.     wm: UINT;                   { WM_* (window message) of event }
  1470.     wParam: WPARAM;             { wParam of message }
  1471.     lParam: LPARAM;             { lParam of message }
  1472.     pt: TPoint;                  { event pt in I-Edit client co-ords }
  1473.     fPen: BOOL;                 { TRUE if pen (or other inking device) }
  1474.     lExInfo: Longint;              { GetMessageExtraInfo() return value }
  1475.     dwReserved: DWORD;          { for future use }
  1476.   end;
  1477.  
  1478.   PStrkFmt = ^TStrkFmt;
  1479.   TStrkFmt = packed record    { 2.0 }
  1480.     cbSize: DWORD;              { sizeof(STRKFMT) }
  1481.     iesf: UINT;                 { stroke format flags and return bits }
  1482.     iStrk: UINT;                { stroke index if IESF_STROKE }
  1483.     tip: TPenTip;                { ink tip attributes }
  1484.     dwUser: DWORD;              { user data for strokes }
  1485.     dwReserved: DWORD;          { for future use }
  1486.   end;
  1487.  
  1488.   PPCMInfo = ^TPCMInfo;
  1489.   TPCMInfo = packed record    { 2.0 Pen Collection Mode Information }
  1490.     cbSize: DWORD;              { sizeof(PCMINFO) }
  1491.     dwPcm: DWORD;               { PCM_xxx flags }
  1492.     rectBound: TRect;            { if finish on pendown outside this rect }
  1493.     rectExclude: TRect;          { if finish on pendown inside this rect }
  1494.     hrgnBound: HRGN;            { if finish on pendown outside this region }
  1495.     hrgnExclude: HRGN;          { if finish on pendown inside this region }
  1496.     dwTimeout: DWORD;           { if finish after timeout, this many ms }
  1497.   end;
  1498.  
  1499.   PInkingInfo = ^TInkingInfo;
  1500.   TInkingInfo = packed record { 2.0 Pen Inking Information }
  1501.     cbSize: DWORD;              { sizeof(INKINGINFO) }
  1502.     wFlags: UINT;               { One of the PII_xx flags }
  1503.     tip: TPenTip;                { Pen type, size and color }
  1504.     rectClip: TRect;             { Clipping rect for the ink }
  1505.     rectInkStop: TRect;          { Rect in which a pen down stops inking }
  1506.     hrgnClip: HRGN;             { Clipping region for the ink }
  1507.     hrgnInkStop: HRGN;          { Region in which a pen down stops inking }
  1508.   end;
  1509.  
  1510.   PSYC = ^TSYC;
  1511.   TSYC = packed record        { 1.0 Symbol Correspondence for Ink }
  1512.     wStrokeFirst: UINT;         { first stroke, inclusive }
  1513.     wPntFirst: UINT;            { first point in first stroke, inclusive }
  1514.     wStrokeLast: UINT;          { last stroke, inclusive }
  1515.     wPntLast: UINT;             { last point in last stroke, inclusive }
  1516.     fLastSyc: BOOL;             { T: no more SYCs follow for current SYE }
  1517.   end;
  1518.  
  1519.   PSYE = ^TSYE;
  1520.   TSYE = packed record        { 1.0 Symbol Element }
  1521.     syv: SYV;                   { symbol value }
  1522.     lRecogVal: Longint;            { for internal use by recognizer }
  1523.     cl: CL;                     { confidence level }
  1524.     iSyc: Integer;                  { SYC index }
  1525.   end;
  1526.  
  1527.   PSYG = ^TSYG;
  1528.   TSYG = packed record        { 1.0 Symbol Graph }
  1529.     rgpntHotSpots: packed array[0..MAXHOTSPOT-1] of TPoint;{ hot spots (max 8) }
  1530.     cHotSpot: Integer;              { number of valid hot spots in rgpntHotSpots }
  1531.     nFirstBox: Integer;             { row-major index to box of 1st char in result }
  1532.     lRecogVal: Longint;            { reserved for use by recoognizer }
  1533.     lpsye: PSYE;               { nodes of symbol graph }
  1534.     cSye: Integer;                  { number of SYEs in symbol graph }
  1535.     lpsyc: PSYC;               { ptr to corresp symbol ink }
  1536.     cSyc: Integer;                  { ditto count }
  1537.   end;
  1538.  
  1539.   PRC = ^TRC;
  1540.   TRC = packed record         { 1.0 Recognition Context (RC) }
  1541.     hrec: HREC;                 { handle of recognizer to use }
  1542.     hwnd: HWND;                 { window to send results to }
  1543.     wEventRef: UINT;            { index into ink buffer }
  1544.     wRcPreferences: UINT;       { flags: RCP_xx Preferences }
  1545.     lRcOptions: Longint;           { RCO_xx options }
  1546.     lpfnYield: TFNRCYieldProc;     { procedure called during Yield() }
  1547.     lpUser: packed array[0..cbRcUserMax-1] of BYTE;{ current writer }
  1548.     wCountry: UINT;             { country code }
  1549.     wIntlPreferences: UINT;     { flags: RCIP_xx }
  1550.     lpLanguage: packed array[0..cbRcLanguageMax-1] of Char;{ language strings }
  1551.     rglpdf: packed array[0..MAXDICTIONARIES-1] of PFNLPDF;{ list of dictionary functions }
  1552.     wTryDictionary: UINT;       { max enumerations to search }
  1553.     clErrorLevel: CL;           { level where recognizer should reject input }
  1554.     alc: ALC;                   { enabled alphabet }
  1555.     alcPriority: ALC;           { prioritizes the ALC_ codes }
  1556.     rgbfAlc: packed array[0..cbRcrgbfAlcMax-1] of BYTE;{ bit field for enabled characters }
  1557.     wResultMode: UINT;          { RRM_xx when to send (asap or when complete) }
  1558.     wTimeOut: UINT;             { recognition timeout in ms }
  1559.     lPcm: Longint;                 { flags: PCM_xx for ending recognition }
  1560.     rectBound: TRect;            { bounding rect for inking (def:screen coords) }
  1561.     rectExclude: TRect;          { pen down inside this terminates recognition }
  1562.     guide: TGuide;               { struct: defines guidelines for recognizer }
  1563.     wRcOrient: UINT;            { RCOR_xx orientation of writing wrt tablet }
  1564.     wRcDirect: UINT;            { RCD_xx direction of writing }
  1565.     nInkWidth: Integer;             { ink width 0 (none) or 1..15 pixels }
  1566.     rgbInk: COLORREF;           { ink color }
  1567.     dwAppParam: DWORD;          { for application use }
  1568.     dwDictParam: DWORD;         { for app use to be passed on to dictionaries }
  1569.     dwRecognizer: DWORD;        { for app use to be passed on to recognizer }
  1570.     rgwReserved: packed array[0..cwRcReservedMax-1] of UINT;{ reserved for future use by Windows }
  1571.   end;
  1572.  
  1573.   PRCResult = ^TRCResult;
  1574.   TRCResult = packed record   { 1.0 Recognition Result }
  1575.     syg: TSYG;                   { symbol graph }
  1576.     wResultsType: UINT;         { see RCRT_xx }
  1577.     cSyv: Integer;                  { count of symbol values }
  1578.     lpsyv: PSYV;               { NULL-term ptr to recog's best guess }
  1579.     hSyv: THandle;               { globally-shared handle to lpsyv mem }
  1580.     nBaseLine: Integer;             { 0 or baseline of input writing }
  1581.     nMidLine: Integer;              { ditto midline }
  1582.     hpendata: HPENDATA;         { pen data mem }
  1583.     rectBoundInk: TRect;         { ink data bounds }
  1584.     pntEnd: TPoint;              { pt that terminated recog }
  1585.     lprc: PRC;                 { recog context used }
  1586.   end;
  1587.  
  1588.   TFNFuncResults = function(p1: PRCResult; p2: REC): Integer stdcall;
  1589.  
  1590.   PTarget = ^TTarget;
  1591.   TTarget = packed record     { 2.0 Geometry for a single target. }
  1592.     dwFlags: DWORD;             { individual target flags }
  1593.     idTarget: DWORD;            { TARGINFO.rgTarget[] index }
  1594.     htrgTarget: HTRG;           { HANDLE32 equiv }
  1595.     rectBound: TRect;           { Bounding rect of the target }
  1596.     dwData: DWORD;              { data collection info per target }
  1597.     rectBoundInk: TRect;        { Reserved for internal use, must be zero }
  1598.     rectBoundLastInk: TRect;    { Reserved for internal use, must be zero }
  1599.   end;
  1600.  
  1601.   PTargInfo = ^TTargInfo;
  1602.   TTargInfo = packed record   { 2.0 A set of targets }
  1603.     cbSize: DWORD;              { sizeof(TARGINFO) }
  1604.     dwFlags: DWORD;             { flags }
  1605.     htrgOwner: HTRG;            { HANDLE32 equiv }
  1606.     cTargets: WORD;             { count of targets }
  1607.     iTargetLast: WORD;          { last target, used by TargetPoints API }
  1608. { if TPT_TEXTUAL flag is set }
  1609.     rgTarget: packed array[0..0] of TTarget;{ variable-length array of targets }
  1610.   end;
  1611.  
  1612.   PInpParams = ^TInpParams;
  1613.   TInpParams = packed record  { 2.0 }
  1614.     cbSize: DWORD;              { sizeof(INPPARAMS) }
  1615.     dwFlags: DWORD;
  1616.     hpndt: HPENDATA;
  1617.     target: TTarget;             { target structure }
  1618.   end;
  1619.  
  1620.   PSKBInfo = ^TSKBInfo;
  1621.   TSKBInfo = packed record
  1622.     handle: HWnd;
  1623.     nPad: Word;
  1624.     fVisible: Bool;
  1625.     fMinimized: Bool;
  1626.     hect: TRect;
  1627.     dwReserved: Longint;
  1628.   end;
  1629.  
  1630.  
  1631. { Utility Functions }
  1632.  
  1633. { Misc }
  1634. function FPenUpX(X: Integer): BOOL;
  1635. function GetWEventRef: Word;
  1636.  
  1637. { ALC: }
  1638. function MpAlcB(lprc: PRC; i: Word): PByte;
  1639. function MpIbf(i: Word): Byte;
  1640. procedure SetAlcBitAnsi(lprc: PRC; i: Word);
  1641. procedure ResetAlcBitAnsi(lprc: PRC; i: Word);
  1642. function IsAlcBitAnsi(lprc: PRC; i: Word): Boolean;
  1643.  
  1644.  
  1645. { draw 2.0 pendata using internal stroke formats: }
  1646. function DrawPenDataFmt(hdc: HDC; lprect: PRect; hpndt: THandle): Integer;
  1647.  
  1648.  
  1649. { Handwriting Recognizer: }
  1650.  
  1651. { Intervals: }
  1652.  
  1653. { difference of two absolute times (at2 > at1 for positive result): }
  1654. function dwDiffAT(at1, at2: TAbsTime): Integer;
  1655.  
  1656. { comparison of two absolute times (TRUE if at1 < at2): }
  1657. function FLTAbsTime(at1, at2: TAbsTime): Boolean;
  1658.  
  1659. function FLTEAbsTime(at1, at2: TAbsTime): Boolean;
  1660.  
  1661. function FEQAbsTime(at1, at2: TAbsTime): Boolean;
  1662.  
  1663. { test if abstime is within an interval: }
  1664. function FAbsTimeInInterval(at: TAbsTime; lpi: PInterval): Boolean;
  1665.  
  1666. { test if interval (lpiT) is within an another interval (lpiS): }
  1667. function FIntervalInInterval(lpiT, lpiS: PInterval): Boolean;
  1668.  
  1669. { test if interval (lpiT) intersects another interval (lpiS): }
  1670. function FIntervalXInterval(lpiT, lpiS: PInterval): Boolean;
  1671.  
  1672. { duration of an PInterval in ms: }
  1673. function dwDurInterval(lpi: PInterval): Integer;
  1674.  
  1675. { fill a pointer to an ABSTIME structure from a count of seconds and ms: }
  1676. procedure MakeAbsTime(var lpat: TAbsTime; sec, ms: Integer);
  1677.  
  1678. { SYV functions: }
  1679.  
  1680. function FIsSpecial(syv: DWORD): Boolean;
  1681. function FIsAnsi(syv: DWORD): Boolean;
  1682. function FIsGesture(syv: DWORD): Boolean;
  1683. function FIsKanji(syv: DWORD): Boolean;
  1684. function FIsShape(syv: DWORD): Boolean;
  1685. function FIsUniCode(syv: DWORD): Boolean;
  1686. function FIsVKey(syv: DWORD): Boolean;
  1687.  
  1688. function ChSyvToAnsi(syv: DWORD): Byte;
  1689. function WSyvToKanji(syv: DWORD): Word;
  1690. function SyvCharacterToSymbol(c: Char): DWORD;
  1691. function SyvKanjiToSymbol(c: Char): DWORD;
  1692.  
  1693. function FIsSelectGesture(syv: DWORD): Boolean;
  1694. function FIsStdGesture(syv: DWORD): Boolean;
  1695. function FIsAnsiGesture(syv: DWORD): Boolean;
  1696.  
  1697. function SubPenMsgFromWpLp(wp, lp: DWORD): Word;
  1698. function EventRefFromWpLp(wp, lp: DWORD): Word;
  1699. function TerminationFromWpLp(wp, lp: DWORD): Integer;
  1700.  
  1701. function HwndFromHtrg(trg: HTRG): HWND;
  1702. function HpcmFromWpLp(wp, lp: DWORD): Integer;
  1703. function HtrgFromHwnd(hwnd: HWND): HTRG;
  1704.  
  1705.  
  1706. { APIs and Prototypes }
  1707.  
  1708. { PenData: }
  1709. function AddPointsPenData(p1: HPENDATA; p2: PPoint; p3: Pointer; 
  1710.   p4: PStrokeInfo): HPENDATA; stdcall;
  1711. function CompressPenData(p1: HPENDATA; p2: UINT; p3: DWORD): Integer; stdcall;
  1712. function CreatePenDataEx(p1: PPenInfo; p2: UINT; p3: UINT; 
  1713.   p4: UINT): HPENDATA; stdcall;
  1714. function CreatePenDataRegion(p1: HPENDATA; p2: UINT): HRGN; stdcall;
  1715. function DestroyPenData(p1: HPENDATA): BOOL; stdcall;
  1716. function DrawPenDataEx(p1: HDC; p2: PRect; p3: HPENDATA; p4: UINT; p5: UINT; 
  1717.   p6: UINT; p7: UINT; p8: TFNAnimateProc; p9: PAnimateInfo; 
  1718.   p10: UINT): Integer; stdcall;
  1719. function DuplicatePenData(p1: HPENDATA; p2: UINT): HPENDATA; stdcall;
  1720. function ExtractPenDataPoints(p1: HPENDATA; p2: UINT; p3: UINT; p4: UINT; 
  1721.   p5: PPoint; p6: Pointer; p7: UINT): Integer; stdcall;
  1722. function ExtractPenDataStrokes(p1: HPENDATA; p2: UINT; p3: LPARAM; 
  1723.   p4: PHPENDATA; p5: UINT): Integer; stdcall;
  1724. function GetPenDataAttributes(p1: HPENDATA; p2: Pointer; p3: UINT): Integer; stdcall;
  1725. function GetPenDataInfo(p1: HPENDATA; p2: PPENDATAHEADER; p3: PPenInfo; 
  1726.   p4: DWORD): BOOL; stdcall;
  1727. function GetPointsFromPenData(p1: HPENDATA; p2: UINT; p3: UINT; p4: UINT; 
  1728.   p5: PPoint): BOOL; stdcall;
  1729. function GetStrokeAttributes(p1: HPENDATA; p2: UINT; p3: Pointer; 
  1730.   p4: UINT): Integer; stdcall;
  1731. function GetStrokeTableAttributes(p1: HPENDATA; p2: UINT; p3: Pointer; 
  1732.   p4: UINT): Integer; stdcall;
  1733. function HitTestPenData(p1: HPENDATA; p2: PPoint; p3: UINT; p4: PUINT; 
  1734.   p5: PUINT): Integer; stdcall;
  1735. function InsertPenData(p1: HPENDATA; p2: HPENDATA; p3: UINT): Integer; stdcall;
  1736. function InsertPenDataPoints(p1: HPENDATA; p2: UINT; p3: UINT; p4: UINT; 
  1737.   p5: PPoint; p6: Pointer): Integer; stdcall;
  1738. function InsertPenDataStroke(p1: HPENDATA; p2: UINT; p3: PPoint; p4: Pointer; 
  1739.   p5: PStrokeInfo): Integer; stdcall;
  1740. function MetricScalePenData(p1: HPENDATA; p2: UINT): BOOL; stdcall;
  1741. function OffsetPenData(p1: HPENDATA; p2: Integer; p3: Integer): BOOL; stdcall;
  1742. function PenDataFromBuffer(p1: PHPENDATA; p2: UINT; p3: PByte; p4: Longint; 
  1743.   p5: PDWORD): Longint; stdcall;
  1744. function PenDataToBuffer(p1: HPENDATA; p2: PByte; p3: Longint; 
  1745.   p4: PDWORD): Longint; stdcall;
  1746. function RedisplayPenData(p1: HDC; p2: HPENDATA; p3: PPoint; p4: PPoint; 
  1747.   p5: Integer; p6: DWORD): BOOL; stdcall;
  1748. function RemovePenDataStrokes(p1: HPENDATA; p2: UINT; p3: UINT): Integer; stdcall;
  1749. function ResizePenData(p1: HPENDATA; p2: PRect): BOOL; stdcall;
  1750. function SetStrokeAttributes(p1: HPENDATA; p2: UINT; p3: LPARAM; 
  1751.   p4: UINT): Integer; stdcall;
  1752. function SetStrokeTableAttributes(p1: HPENDATA; p2: UINT; p3: LPARAM; 
  1753.   p4: UINT): Integer; stdcall;
  1754. function TrimPenData(p1: HPENDATA; p2: DWORD; p3: DWORD): Integer; stdcall;
  1755.  
  1756.  
  1757. { Dictionary: }
  1758. function DictionarySearch(p1: PRC; p2: PSYE; p3: Integer; p4: PSYV; 
  1759.   p5: Integer): BOOL; stdcall;
  1760.  
  1761. { Pen Hardware/Driver: }
  1762. function GetPenAsyncState(p1: UINT): BOOL; stdcall;
  1763. function IsPenEvent(p1: UINT; p2: Longint): BOOL; stdcall;
  1764.  
  1765.  
  1766. { Handwriting Recognizer: }
  1767. function AddPenDataHRC(p1: HRC; p2: HPENDATA): Integer; stdcall;
  1768. function AddPenInputHRC(p1: HRC; p2: PPoint; p3: Pointer; p4: UINT; 
  1769.   p5: PStrokeInfo): Integer; stdcall;
  1770. function AddWordsHWL(p1: HWL; p2: LPSTR; p3: UINT): Integer; stdcall;
  1771. function ConfigHREC(p1: HREC; p2: UINT; p3: WPARAM; p4: LPARAM): Integer; stdcall;
  1772. function CreateCompatibleHRC(p1: HRC; p2: HREC): HRC; stdcall;
  1773. function CreateHWL(p1: HREC; p2: LPSTR; p3: UINT; p4: DWORD): HWL; stdcall;
  1774. function CreateInksetHRCRESULT(p1: HRCRESULT; p2: UINT; 
  1775.   p3: UINT): HINKSET; stdcall;
  1776. function CreatePenDataHRC(p1: HRC): HPENDATA; stdcall;
  1777. function DestroyHRC(p1: HRC): Integer; stdcall;
  1778. function DestroyHRCRESULT(p1: HRCRESULT): Integer; stdcall;
  1779. function DestroyHWL(p1: HWL): Integer; stdcall;
  1780. function EnableGestureSetHRC(p1: HRC; p2: SYV; p3: BOOL): Integer; stdcall;
  1781. function EnableSystemDictionaryHRC(p1: HRC; p2: BOOL): Integer; stdcall;
  1782. function EndPenInputHRC(p1: HRC): Integer; stdcall;
  1783. function GetAlphabetHRC(p1: HRC; p2: PALC; p3: PByte): Integer; stdcall;
  1784. function GetAlphabetPriorityHRC(p1: HRC; p2: PALC; p3: PByte): Integer; stdcall;
  1785. function GetAlternateWordsHRCRESULT(p1: HRCRESULT; p2: UINT; p3: UINT; 
  1786.   p4: PHRCRESULT; p5: UINT): Integer; stdcall;
  1787. function GetBoxMappingHRCRESULT(p1: HRCRESULT; p2, p3: UINT; 
  1788.   p4: PUINT): Integer; stdcall;
  1789. function GetBoxResultsHRC(p1: HRC; p2, p3, p4: UINT; 
  1790.   p5: PBoxResults; p6: BOOL): Integer; stdcall;
  1791. function GetGuideHRC(p1: HRC; p2: PGuide; p3: PUINT): Integer; stdcall;
  1792. function GetHotspotsHRCRESULT(p1: HRCRESULT; p2: UINT; p3: PPoint; 
  1793.   p4: UINT): Integer; stdcall;
  1794. function GetHRECFromHRC(p1: HRC): HREC; stdcall;
  1795. function GetInternationalHRC(p1: HRC; p2: PUINT; p3: LPSTR; p4: PUINT; 
  1796.   p5: PUINT): Integer; stdcall;
  1797. function GetMaxResultsHRC(p1: HRC): Integer; stdcall;
  1798. function GetResultsHRC(p1: HRC; p2: UINT; p3: PHRCRESULT; 
  1799.   p4: UINT): Integer; stdcall;
  1800. function GetSymbolCountHRCRESULT(p1: HRCRESULT): Integer; stdcall;
  1801. function GetSymbolsHRCRESULT(p1: HRCRESULT; p2: UINT; p3: PSYV; 
  1802.   p4: UINT): Integer; stdcall;
  1803. function GetWordlistHRC(p1: HRC; p2: PHWL): Integer; stdcall;
  1804. function GetWordlistCoercionHRC(p1: HRC): Integer; stdcall;
  1805. function ProcessHRC(p1: HRC; p2: DWORD): Integer; stdcall;
  1806. function ReadHWL(p1: HWL; p2: HFILE): Integer; stdcall;
  1807. function SetAlphabetHRC(p1: HRC; p2: ALC; p3: PByte): Integer; stdcall;
  1808. function SetAlphabetPriorityHRC(p1: HRC; p2: ALC; p3: PByte): Integer; stdcall;
  1809. function SetBoxAlphabetHRC(p1: HRC; p2: PALC; p3: UINT): Integer; stdcall;
  1810. function SetGuideHRC(p1: HRC; p2: PGuide; p3: UINT): Integer; stdcall;
  1811. function SetInternationalHRC(p1: HRC; p2: UINT; p3: LPCSTR; p4: UINT; 
  1812.   p5: UINT): Integer; stdcall;
  1813. function SetMaxResultsHRC(p1: HRC; p2: UINT): Integer; stdcall;
  1814. function SetResultsHookHREC(p1: HREC; var p2: TFNHRCResultHookProc): HRECHOOK; stdcall;
  1815. function SetWordlistCoercionHRC(p1: HRC; p2: UINT): Integer; stdcall;
  1816. function SetWordlistHRC(p1: HRC; p2: HWL): Integer; stdcall;
  1817. function TrainHREC(p1: HREC; p2: PSYV; p3: UINT; p4: HPENDATA; 
  1818.   p5: UINT): Integer; stdcall;
  1819. function UnhookResultsHookHREC(p1: HREC; p2: HRECHOOK): Integer; stdcall;
  1820. function WriteHWL(p1: HWL; p2: HFILE): Integer; stdcall;
  1821.  
  1822. { Recognizer Installation: }
  1823. function InstallRecognizer(p1: LPSTR): HREC; stdcall;
  1824. function UninstallRecognizer(p1: HREC): Pointer; stdcall;
  1825.  
  1826. { Inksets: }
  1827. function AddInksetInterval(p1: HINKSET; p2: PInterval): BOOL; stdcall;
  1828. function CreateInkset(p1: UINT): HINKSET; stdcall;
  1829. function DestroyInkset(p1: HINKSET): BOOL; stdcall;
  1830. function GetInksetInterval(p1: HINKSET; p2: UINT; p3: PInterval): Integer; stdcall;
  1831. function GetInksetIntervalCount(p1: HINKSET): Integer; stdcall;
  1832.  
  1833. { Symbol Values: }
  1834. function CharacterToSymbol(p1: LPSTR; p2: Integer; p3: PSYV): Integer; stdcall;
  1835. function SymbolToCharacter(p1: PSYV; p2: Integer; p3: LPSTR; 
  1836.   p4: PINT): BOOL; stdcall;
  1837.  
  1838.  
  1839. { Pen Input/Inking: }
  1840. function DoDefaultPenInput(p1: HWND; p2: UINT): Integer; stdcall;
  1841. function GetPenInput(p1: HPCM; p2: PPoint; p3: Pointer; p4: UINT; p5: UINT; 
  1842.   p6: PStrokeInfo): Integer; stdcall;
  1843. function PeekPenInput(p1: HPCM; p2: UINT; p3: PPoint; p4: Pointer; 
  1844.   p5: UINT): Integer; stdcall;
  1845. function StartInking(p1: HPCM; p2: UINT; p3: PInkingInfo): Integer; stdcall;
  1846. function StartPenInput(p1: HWND; p2: UINT; p3: PPCMInfo; 
  1847.   p4: PINT): HPCM; stdcall;
  1848. function StopInking(p1: HPCM): Integer; stdcall;
  1849. function StopPenInput(p1: HPCM; p2: UINT; p3: Integer): Integer; stdcall;
  1850.  
  1851.  
  1852. { Miscellaneous/Utilities: }
  1853. function BoundingRectFromPoints(p1: PPoint; p2: UINT; 
  1854.   p3: PRect): Pointer; stdcall;
  1855. function DPtoTP(p1: PPoint; p2: Integer): BOOL; stdcall;
  1856. function GetPenAppFlags: UINT; stdcall; 
  1857. function SetPenAppFlags(p1: UINT; p2: UINT): Pointer; stdcall;
  1858. function GetPenMiscInfo(p1: WPARAM; p2: LPARAM): Longint; stdcall;
  1859. function GetVersionPenWin: UINT; stdcall; 
  1860. function SetPenMiscInfo(p1: WPARAM; p2: LPARAM): Longint; stdcall;
  1861. function TPtoDP(p1: PPoint; p2: Integer): BOOL; stdcall;
  1862. function CorrectWriting(p1: HWND; p2: LPSTR; p3: UINT; p4: Pointer; p5: DWORD; 
  1863.   p6: DWORD): BOOL; stdcall;
  1864.  
  1865. { Ink Targeting: }
  1866. function TargetPoints(p1: PTargInfo; p2: PPoint; p3: DWORD; p4: UINT; 
  1867.   p5: PStrokeInfo): Integer; stdcall;
  1868.  
  1869. { Virtual Event Layer: }
  1870. function AtomicVirtualEvent(p1: BOOL): Pointer; stdcall;
  1871.  
  1872. { Kanji }
  1873. function KKConvert(hwndConvert: HWND; hwndCaller: HWND; lpBuf: LPSTR; 
  1874.   cbBuf: UINT; lpPnt: PPoint): BOOL; stdcall;
  1875.  
  1876. implementation
  1877.  
  1878. const
  1879.   penwin32 = 'penwin32.dll';
  1880.   
  1881. function AddInksetInterval;             external penwin32 name 'AddInksetInterval';
  1882. function AddPenDataHRC;                 external penwin32 name 'AddPenDataHRC';
  1883. function AddPenInputHRC;                external penwin32 name 'AddPenInputHRC';
  1884. function AddPointsPenData;              external penwin32 name 'AddPointsPenData';
  1885. function AddWordsHWL;                   external penwin32 name 'AddWordsHWL';
  1886. function AtomicVirtualEvent;            external penwin32 name 'AtomicVirtualEvent';
  1887. function BoundingRectFromPoints;        external penwin32 name 'BoundingRectFromPoints';
  1888. function CharacterToSymbol;             external penwin32 name 'CharacterToSymbol';
  1889. function CompressPenData;               external penwin32 name 'CompressPenData';
  1890. function ConfigHREC;                    external penwin32 name 'ConfigHREC';
  1891. function CorrectWriting;                external penwin32 name 'CorrectWriting';
  1892. function CreateCompatibleHRC;           external penwin32 name 'CreateCompatibleHRC';
  1893. function CreateHWL;                     external penwin32 name 'CreateHWL';
  1894. function CreateInkset;                  external penwin32 name 'CreateInkset';
  1895. function CreateInksetHRCRESULT;         external penwin32 name 'CreateInksetHRCRESULT';
  1896. function CreatePenDataEx;               external penwin32 name 'CreatePenDataEx';
  1897. function CreatePenDataHRC;              external penwin32 name 'CreatePenDataHRC';
  1898. function CreatePenDataRegion;           external penwin32 name 'CreatePenDataRegion';
  1899. function DestroyHRC;                    external penwin32 name 'DestroyHRC';
  1900. function DestroyHRCRESULT;              external penwin32 name 'DestroyHRCRESULT';
  1901. function DestroyHWL;                    external penwin32 name 'DestroyHWL';
  1902. function DestroyInkset;                 external penwin32 name 'DestroyInkset';
  1903. function DestroyPenData;                external penwin32 name 'DestroyPenData';
  1904. function DictionarySearch;              external penwin32 name 'DictionarySearch';
  1905. function DoDefaultPenInput;             external penwin32 name 'DoDefaultPenInput';
  1906. function DPtoTP;                        external penwin32 name 'DPtoTP';
  1907. function DrawPenDataEx;                 external penwin32 name 'DrawPenDataEx';
  1908. function DuplicatePenData;              external penwin32 name 'DuplicatePenData';
  1909. function EnableGestureSetHRC;           external penwin32 name 'EnableGestureSetHRC';
  1910. function EnableSystemDictionaryHRC;     external penwin32 name 'EnableSystemDictionaryHRC';
  1911. function EndPenInputHRC;                external penwin32 name 'EndPenInputHRC';
  1912. function ExtractPenDataPoints;          external penwin32 name 'ExtractPenDataPoints';
  1913. function ExtractPenDataStrokes;         external penwin32 name 'ExtractPenDataStrokes';
  1914. function GetAlphabetHRC;                external penwin32 name 'GetAlphabetHRC';
  1915. function GetAlphabetPriorityHRC;        external penwin32 name 'GetAlphabetPriorityHRC';
  1916. function GetAlternateWordsHRCRESULT;    external penwin32 name 'GetAlternateWordsHRCRESULT';
  1917. function GetBoxMappingHRCRESULT;        external penwin32 name 'GetBoxMappingHRCRESULT';
  1918. function GetBoxResultsHRC;              external penwin32 name 'GetBoxResultsHRC';
  1919. function GetGuideHRC;                   external penwin32 name 'GetGuideHRC';
  1920. function GetHotspotsHRCRESULT;          external penwin32 name 'GetHotspotsHRCRESULT';
  1921. function GetHRECFromHRC;                external penwin32 name 'GetHRECFromHRC';
  1922. function GetInksetInterval;             external penwin32 name 'GetInksetInterval';
  1923. function GetInksetIntervalCount;        external penwin32 name 'GetInksetIntervalCount';
  1924. function GetInternationalHRC;           external penwin32 name 'GetInternationalHRC';
  1925. function GetMaxResultsHRC;              external penwin32 name 'GetMaxResultsHRC';
  1926. function GetPenAppFlags;                external penwin32 name 'GetPenAppFlags';
  1927. function GetPenAsyncState;              external penwin32 name 'GetPenAsyncState';
  1928. function GetPenDataAttributes;          external penwin32 name 'GetPenDataAttributes';
  1929. function GetPenDataInfo;                external penwin32 name 'GetPenDataInfo';
  1930. function GetPenInput;                   external penwin32 name 'GetPenInput';
  1931. function GetPenMiscInfo;                external penwin32 name 'GetPenMiscInfo';
  1932. function GetPointsFromPenData;          external penwin32 name 'GetPointsFromPenData';
  1933. function GetResultsHRC;                 external penwin32 name 'GetResultsHRC';
  1934. function GetStrokeAttributes;           external penwin32 name 'GetStrokeAttributes';
  1935. function GetStrokeTableAttributes;      external penwin32 name 'GetStrokeTableAttributes';
  1936. function GetSymbolCountHRCRESULT;       external penwin32 name 'GetSymbolCountHRCRESULT';
  1937. function GetSymbolsHRCRESULT;           external penwin32 name 'GetSymbolsHRCRESULT';
  1938. function GetVersionPenWin;              external penwin32 name 'GetVersionpenwin32';
  1939. function GetWordlistCoercionHRC;        external penwin32 name 'GetWordlistCoercionHRC';
  1940. function GetWordlistHRC;                external penwin32 name 'GetWordlistHRC';
  1941. function HitTestPenData;                external penwin32 name 'HitTestPenData';
  1942. function InsertPenData;                 external penwin32 name 'InsertPenData';
  1943. function InsertPenDataPoints;           external penwin32 name 'InsertPenDataPoints';
  1944. function InsertPenDataStroke;           external penwin32 name 'InsertPenDataStroke';
  1945. function InstallRecognizer;             external penwin32 name 'InstallRecognizer';
  1946. function IsPenEvent;                    external penwin32 name 'IsPenEvent';
  1947. function KKConvert;                     external penwin32 name 'KKConvert';
  1948. function MetricScalePenData;            external penwin32 name 'MetricScalePenData';
  1949. function OffsetPenData;                 external penwin32 name 'OffsetPenData';
  1950. function PeekPenInput;                  external penwin32 name 'PeekPenInput';
  1951. function PenDataFromBuffer;             external penwin32 name 'PenDataFromBuffer';
  1952. function PenDataToBuffer;               external penwin32 name 'PenDataToBuffer';
  1953. function ProcessHRC;                    external penwin32 name 'ProcessHRC';
  1954. function ReadHWL;                       external penwin32 name 'ReadHWL';
  1955. function RedisplayPenData;              external penwin32 name 'RedisplayPenData';
  1956. function RemovePenDataStrokes;          external penwin32 name 'RemovePenDataStrokes';
  1957. function ResizePenData;                 external penwin32 name 'ResizePenData';
  1958. function SetAlphabetHRC;                external penwin32 name 'SetAlphabetHRC';
  1959. function SetAlphabetPriorityHRC;        external penwin32 name 'SetAlphabetPriorityHRC';
  1960. function SetBoxAlphabetHRC;             external penwin32 name 'SetBoxAlphabetHRC';
  1961. function SetGuideHRC;                   external penwin32 name 'SetGuideHRC';
  1962. function SetInternationalHRC;           external penwin32 name 'SetInternationalHRC';
  1963. function SetMaxResultsHRC;              external penwin32 name 'SetMaxResultsHRC';
  1964. function SetPenAppFlags;                external penwin32 name 'SetPenAppFlags';
  1965. function SetPenMiscInfo;                external penwin32 name 'SetPenMiscInfo';
  1966. function SetResultsHookHREC;            external penwin32 name 'SetResultsHookHREC';
  1967. function SetStrokeAttributes;           external penwin32 name 'SetStrokeAttributes';
  1968. function SetStrokeTableAttributes;      external penwin32 name 'SetStrokeTableAttributes';
  1969. function SetWordlistCoercionHRC;        external penwin32 name 'SetWordlistCoercionHRC';
  1970. function SetWordlistHRC;                external penwin32 name 'SetWordlistHRC';
  1971. function StartInking;                   external penwin32 name 'StartInking';
  1972. function StartPenInput;                 external penwin32 name 'StartPenInput';
  1973. function StopInking;                    external penwin32 name 'StopInking';
  1974. function StopPenInput;                  external penwin32 name 'StopPenInput';
  1975. function SymbolToCharacter;             external penwin32 name 'SymbolToCharacter';
  1976. function TargetPoints;                  external penwin32 name 'TargetPoints';
  1977. function TPtoDP;                        external penwin32 name 'TPtoDP';
  1978. function TrainHREC;                     external penwin32 name 'TrainHREC';
  1979. function TrimPenData;                   external penwin32 name 'TrimPenData';
  1980. function UnhookResultsHookHREC;         external penwin32 name 'UnhookResultsHookHREC';
  1981. function UninstallRecognizer;           external penwin32 name 'UninstallRecognizer';
  1982. function WriteHWL;                      external penwin32 name 'WriteHWL';
  1983.  
  1984. function FPenUpX(X: Integer): BOOL;
  1985. begin
  1986.   Result := (X and BITPENUP) <> 0;
  1987. end;
  1988.  
  1989. function GetWEventRef: Word;
  1990. begin
  1991.   Result := Word(GetMessageExtraInfo);
  1992. end;
  1993.  
  1994. function MpAlcB(lprc: PRC; i: Word): PByte;
  1995. begin
  1996.   Result := @lprc^.rgbfAlc[ (i and $FF) shr 3 ];
  1997. end;
  1998.  
  1999. function MpIbf(i: Word): Byte;
  2000. begin
  2001.   Result := 1 shl (i and 7);
  2002. end;
  2003.  
  2004. procedure SetAlcBitAnsi(lprc: PRC; i: Word);
  2005. var
  2006.   P: PByte;
  2007. begin
  2008.   P := MpAlcB(lprc, i);
  2009.   P^ := P^ or MpIbf(i);
  2010. end;
  2011.  
  2012. procedure ResetAlcBitAnsi(lprc: PRC; i: Word);
  2013. var
  2014.   P: PByte;
  2015. begin
  2016.   P := MpAlcB(lprc, i);
  2017.   P^ := P^ and not MpIbf(i);
  2018. end;
  2019.  
  2020. function IsAlcBitAnsi(lprc: PRC; i: Word): Boolean;
  2021. begin
  2022.   Result := MpAlcB(lprc,i)^ and MpIbf(i) <> 0;
  2023. end;
  2024.  
  2025. function DrawPenDataFmt(hdc: HDC; lprect: PRect; hpndt: THandle): Integer;
  2026. begin
  2027.   Result := DrawPenDataEx(hdc, lprect, hpndt, 0, IX_END, 0, IX_END, nil, nil, 0);
  2028. end;
  2029.  
  2030. function dwDiffAT(at1, at2: TAbsTime): Integer;
  2031. begin
  2032.   Result := 1000 * (at2.sec - at1.sec) - (at1.ms + at2.ms);
  2033. end;
  2034.  
  2035. function FLTAbsTime(at1, at2: TAbsTime): Boolean;
  2036. begin
  2037.   Result := (at1.sec < at2.sec) or ((at1.sec = at2.sec) and (at1.ms < at2.ms));
  2038. end;
  2039.  
  2040. function FLTEAbsTime(at1, at2: TAbsTime): Boolean;
  2041. begin
  2042.   Result := (at1.sec < at2.sec) or ((at1.sec = at2.sec) and (at1.ms <= at2.ms));
  2043. end;
  2044.  
  2045. function FEQAbsTime(at1, at2: TAbsTime): Boolean;
  2046. begin
  2047.   Result := (at1.sec = at2.sec) and (at1.ms = at2.ms);
  2048. end;
  2049.  
  2050. function FAbsTimeInInterval(at: TAbsTime; lpi: PInterval): Boolean;
  2051. begin
  2052.   Result := FLTEAbsTime(lpi^.atBegin, at) and FLTEAbsTime(at, lpi^.atEnd);
  2053. end;
  2054.  
  2055. function FIntervalInInterval(lpiT, lpiS: PInterval): Boolean;
  2056. begin
  2057.   Result := FLTEAbsTime(lpiS^.atBegin, lpiT^.atBegin) and
  2058.     FLTEAbsTime(lpiT^.atEnd, lpiS^.atEnd);
  2059. end;
  2060.  
  2061. function FIntervalXInterval(lpiT, lpiS: PInterval): Boolean;
  2062. begin
  2063.   Result := (not FLTAbsTime(lpiT^.atEnd, lpiS^.atBegin)) or
  2064.      FLTAbsTime(lpiS^.atEnd, lpiT^.atBegin);
  2065. end;
  2066.  
  2067. function dwDurInterval(lpi: PInterval): Integer;
  2068. begin
  2069.   Result := dwDiffAT(lpi^.atBegin, lpi^.atEnd);
  2070. end;
  2071.  
  2072. procedure MakeAbsTime(var lpat: TAbsTime; sec, ms: Integer);
  2073. begin
  2074.   lpat.sec := sec + ms div 1000;
  2075.   lpat.ms := ms mod 1000;
  2076. end;
  2077.  
  2078. function FIsSpecial(syv: DWORD): Boolean;
  2079. begin
  2080.   Result := HiWord(syv) = SYVHI_SPECIAL;
  2081. end;
  2082.  
  2083. function FIsAnsi(syv: DWORD): Boolean;
  2084. begin
  2085.   Result := HiWord(syv) = SYVHI_ANSI;
  2086. end;
  2087.  
  2088. function FIsGesture(syv: DWORD): Boolean;
  2089. begin
  2090.   Result := HiWord(syv) = SYVHI_GESTURE;
  2091. end;
  2092.  
  2093. function FIsKanji(syv: DWORD): Boolean;
  2094. begin
  2095.   Result := HiWord(syv) = SYVHI_KANJI;
  2096. end;
  2097.  
  2098. function FIsShape(syv: DWORD): Boolean;
  2099. begin
  2100.   Result := HiWord(syv) = SYVHI_SHAPE;
  2101. end;
  2102.  
  2103. function FIsUniCode(syv: DWORD): Boolean;
  2104. begin
  2105.   Result := HiWord(syv) = SYVHI_UNICODE;
  2106. end;
  2107.  
  2108. function FIsVKey(syv: DWORD): Boolean;
  2109. begin
  2110.   Result := HiWord(syv) = SYVHI_VKEY;
  2111. end;
  2112.  
  2113. function ChSyvToAnsi(syv: DWORD): Byte;
  2114. begin
  2115.   Result := Byte(LOWORD(syv));
  2116. end;
  2117.  
  2118. function WSyvToKanji(syv: DWORD): Word;
  2119. begin
  2120.   Result := LOWORD(syv);
  2121. end;
  2122.  
  2123. function SyvCharacterToSymbol(c: Char): DWORD;
  2124. begin
  2125.   Result := Byte(c) or $10000;
  2126. end;
  2127.  
  2128. function SyvKanjiToSymbol(c: Char): DWORD;
  2129. begin
  2130.   Result := Byte(c) or $30000;
  2131. end;
  2132.  
  2133. function FIsSelectGesture(syv: DWORD): Boolean;
  2134. begin
  2135.   Result := (syv >= SYV_SELECTFIRST) and (syv <= SYV_SELECTLAST);
  2136. end;
  2137.  
  2138. function FIsStdGesture(syv: DWORD): Boolean;
  2139. begin
  2140.   Result := FIsSelectGesture(syv) or (syv = SYV_CLEAR) or (syv = SYV_HELP) or 
  2141.     (syv = SYV_EXTENDSELECT) or (syv = SYV_UNDO) or (syv = SYV_COPY) or 
  2142.     (syv = SYV_CUT) or (syv = SYV_PASTE) or (syv = SYV_CLEARWORD) or 
  2143.     (syv = SYV_KKCONVERT) or (syv = SYV_USER) or (syv = SYV_CORRECT);
  2144. end;
  2145.  
  2146. function FIsAnsiGesture(syv: DWORD): Boolean;
  2147. begin
  2148.   Result := (syv = SYV_BACKSPACE) or (syv = SYV_TAB) or 
  2149.     (syv = SYV_RETURN) or (syv = SYV_SPACE);
  2150. end;
  2151.  
  2152. function SubPenMsgFromWpLp(wp, lp: DWORD): Word;
  2153. begin
  2154.   Result := LOWORD(wp);
  2155. end;
  2156.  
  2157. function EventRefFromWpLp(wp, lp: DWORD): Word;
  2158. begin
  2159.   Result := HiWord(wp);
  2160. end;
  2161.  
  2162. function TerminationFromWpLp(wp, lp: DWORD): Integer;
  2163. begin
  2164.   Result := HiWord(wp);
  2165. end;
  2166.  
  2167. function HpcmFromWpLp(wp, lp: DWORD): Integer;
  2168. begin
  2169.   Result := HPCM(lp);
  2170. end;
  2171.  
  2172. function HwndFromHtrg(trg: HTRG): HWND;
  2173. begin
  2174.   Result := HWND(trg);
  2175. end;
  2176.  
  2177. function HtrgFromHwnd(hwnd: HWND): HTRG;
  2178. begin
  2179.   Result := HTRG(hwnd);
  2180. end;
  2181.  
  2182. end.
  2183.